proxybroker with proxychains one line.

proxybroker is very useful proxy grabbing tool.

First I need update proxychains-ng. I was update manually proxychains-ng config at recent few days.

proxybroker with

Convert to proxychains-ng description method.

proxybroker find --types HTTPS --lvl High --strict -l 5 | gawk -F' ' '{print $5}' | gawk -F'>' '{print $1}' | sed -e 's/^/http /' | sed -e 's/:/ /'

Next update with old config. Get old config.

cat /etc/proxychains.conf | head -n 64

Link string and write config

echo -e "$(cat /etc/proxychains.conf | head -n 64)\n$(proxybroker find --types HTTPS --lvl High --strict -l 500 | gawk -F' ' '{print $5}' | gawk -F'>' '{print $1}' | sed -e 's/^/http /' | sed -e 's/:/ /')" > /etc/proxychains.conf

and cron or anything. work fine.

---- update
WOW. proxychains format will comming!?
Not yet ? (・∀・ )っ/凵⌒☆clinkclink

github.com

githubさんにflaggった

先ほど投稿したのリンクによって、githubのflaggを食らいました。

https://gist.github.com/s3ij1nn/f321eafc02c06a353ed7db92f6e999b7

とりあえずコンタクトにスクリーンショット付きの画像とHow can i do that?と送っておきました。

スクショ付きなのですぐに、人間だとわかると思いますが、画像を送りつけるのはある意味嫌がらせに近いかもしれませんね。

f:id:s3ij1nn:20190201175345p:plain

docker で php7.2-apache xdebug 環境を構築するまで

環境は

$HOME/dev/project/www

動かすディレクトリは www/html で自作phprouterが動いている

www/html/.htacess

<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^(.*)$ index.php [NC,L]
</IfModule>

www/docker-compose.yml

version: "3.7"
services:
  php:
    build:
      context: ./docker
    ports:
      - "80:80"
      - "9000:9000"
    tty: true
    stdin_open: true
    volumes:
      - ./:/var/www
      - ./docker/php.ini:/usr/local/etc/php/php.ini

www/docker/Dockerfile

FROM php:7.2-apache

RUN apt-get update
RUN apt-get install vim -y
RUN pecl install xdebug
RUN a2enmod rewrite

WORKDIR /var/www

www/docker/php.ini

https://gist.github.com/s3ij1nn/f321eafc02c06a353ed7db92f6e999b7

既に動いているか確認してからコマンドを実行する1行シェルスクリプト

既に動いているか確認してからコマンドを実行する1行シェルスクリプト

ps ax | grep [c]ommand | grep [a]rgv1 | grep [a]rgv2 | wc -l

0 動いていない
1 1つ動いている

動いていない事を確認したら実行する

if [ $(ps ax | grep [c]ommand | grep [a]rgv1 | grep [a]rgv2 | wc -l) == 0] ; then command -argv1 -argv2 ; fi;

cronを動かす際に、2回目の実行前に前に実行したコマンドが終了していない時なんかに便利。

ちなみに、APIを叩いて状況を確認した上でコマンドが終了していないか確認する方法は

if [ $(curl -s http://localhost/api/api.json) == '[]' ] && [ $(ps ax | grep [c]ommand | grep [a]rgv1 | grep [a]rgv2 | wc -l) == 0 ] ; command -argv1 -argv2 ; fi;

整形するとこんな感じ

if
  [ $(curl -s http://localhost/api/api.json) == '[]' ] &&
  [ $(ps ax | grep [c]ommand | grep [a]rgv1 | grep [a]rgv2 | wc -l) == 0 ] ;
  then
    command -argv1 -argv2 ;
fi;

ライブラリなどが含まれた大量のファイル群ををscpやrsyncを使わずにsshとtarでアップロードする方法

ライブラリなどが含まれた大量のファイル群ををscpやrsyncを使わずにsshとtarでアップロードする方法

私は普段rsyncのscpを使っていましたが便利だったのでメモします。

~/some_file_folder に転送する場合

tar -cf - some_file_folder | ssh server 'tar -xf - '

/var/www/some_file_folder に転送する場合

tar -cf - some_file_folder | ssh server 'tar -xf - -C /var/www'

圧縮する場合

tar -czf - some_file_folder | ssh dest.server 'tar -xzf - -C /var/www'

CPU暗号を使う場合

tar -cf - some_file_folder | ssh -c arcfour dest.server 'tar -xf - '

大きなファイルを含む際にはパイプを使うのでメモリを使うかも知れません。 アップロードする前にディレクトリサイズを確認しておきましょう。

du -sh  some_file_folder

https://serverfault.com/a/326508

thebase.in の advent calendar を読んでみる

devblog.thebase.in

TheBaseはCakePHPを用いている模様。

特に

devblog.thebase.in

は面白い。

OKRについて調べていたら、GoogleDocumentで管理が出来る、Google公式サービスを見つけた。

g.co

組織のマネジメント方法について様々な方法が書かれていて面白い。

Macを再インストールしてからやった事

初めまして。s3ij1nnと申します。よろしくお願いします。

 

まず最初にMacをクリーン再インストールしました。

今回はその後設定した事をメモします。

 

brewをインストールする。

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

docker, vagrant は環境汚染を防ぐ為に入れました。

brew install vim curl wget git tmux rclone python zsh
brew cask install iterm2 vagrant virtualbox docker docker-compose docker-machine

oh-my-zsh のインストール

oh-my-bash, bash_it, Prezto, fish 等の経験がありますが、テーマやプラグイン、普段使うショートカットキー等で不便と感じることがあったので人口が多いoh-my-zshに帰ります。

また使いたいと思ったら仮想コンテナ上で動かす予定です。

sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

zshのテーマは適当でいいです。

tmux の powerline をインストールする。

pip3 install git+https://github.com/powerline/powerline -v

vim .tmux.conf

run-shell "powerline-daemon -q"
source /usr/local/lib/python3.7/site-packages/powerline/bindings/tmux/powerline.conf

vim のパッケージマネージャーと設定

vim には パッケージマネージャー dein とか nvim を使うとか色々ありますが、いろんなパッケージをインストールしたらどちらにしろ重いです。

パッケージマネージャのコマンド名が色々ありすぎてめんどくさくなりました。

コマンド名がシンプルな Vundle を使います。

その他の設定では

qiita.com

を参考にしました。

git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim

.vimrc

" Vundle

set nocompatible              " be iMproved, required
filetype off                  " required

" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')

" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'

Plugin 'mattn/emmet-vim'
Plugin 'scrooloose/syntastic'
Plugin 'scrooloose/nerdtree'

" The following are examples of different formats supported.
" Keep Plugin commands between vundle#begin/end.
" plugin on GitHub repo
" Plugin 'tpope/vim-fugitive'
" plugin from http://vim-scripts.org/vim/scripts.html
" Plugin 'L9'
" Git plugin not hosted on GitHub
" Plugin 'git://git.wincent.com/command-t.git'
" git repos on your local machine (i.e. when working on your own plugin)
" Plugin 'file:///home/gmarik/path/to/plugin'
" The sparkup vim script is in a subdirectory of this repo called vim.
" Pass the path to set the runtimepath properly.
" Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
" Install L9 and avoid a Naming conflict if you've already installed a
" different version somewhere else.
" Plugin 'ascenator/L9', {'name': 'newL9'}

" All of your Plugins must be added before the following line
call vundle#end()            " required
filetype plugin indent on    " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList       - lists configured plugins
" :PluginInstall    - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean      - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line

" setting
"文字コードをUFT-8に設定
set fenc=utf-8
" バックアップファイルを作らない
set nobackup
" スワップファイルを作らない
set noswapfile
" 編集中のファイルが変更されたら自動で読み直す
set autoread
" バッファが編集中でもその他のファイルを開けるように
set hidden
" 入力中のコマンドをステータスに表示する
set showcmd


" 見た目系
" 行番号を表示
set number
" 現在の行を強調表示
set cursorline
" 現在の行を強調表示(縦)
set cursorcolumn
" 行末の1文字先までカーソルを移動できるように
set virtualedit=onemore
" インデントはスマートインデント
set smartindent
" ビープ音を可視化
set visualbell
" 括弧入力時の対応する括弧を表示
set showmatch
" ステータスラインを常に表示
set laststatus=2
" コマンドラインの補完
set wildmode=list:longest
" 折り返し時に表示行単位での移動できるようにする
nnoremap j gj
nnoremap k gk


" Tab系
" 不可視文字を可視化(タブが「▸-」と表示される)
set list listchars=tab:\▸\-
" Tab文字を半角スペースにする
set expandtab
" 行頭以外のTab文字の表示幅(スペースいくつ分)
set tabstop=2
" 行頭でのTab文字の表示幅
set shiftwidth=2


" 検索系
" 検索文字列が小文字の場合は大文字小文字を区別なく検索する
set ignorecase
" 検索文字列に大文字が含まれている場合は区別して検索する
set smartcase
" 検索文字列入力時に順次対象文字列にヒットさせる
set incsearch
" 検索時に最後まで行ったら最初に戻る
set wrapscan
" 検索語をハイライト表示
set hlsearch
" ESC連打でハイライト解除
nmap <Esc><Esc> :nohlsearch<CR><Esc>

" NERDTree
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | endif

パッケージで入れたのは syntastic emmet NERDTreeのみです。

もっと他にインストールするならば、virtualboxかdockerで運用する予定です。

パスワードマネージャ

1password, lastpass, Password Store(GPG encrypt password manager), MasterPassword 等の経験があり、現在 1password に課金していますが、個人的には KeeWeb が無料の中では安定しているように感じます。

Androidスマートフォン, もう2台のMacと同期したいので、同期しやすく無料のKeeWebを選びました。

しばらくは 1password を使ってい KeeWeb に慣れてきたら切り替えようと思います。

Terminal 環境

Terminal のフォント, カラーもプログラミングをする上では重要なファクターの一つです。

そこで Ricty Diminished Powerline と japanesque を使います。

github.com

github.com

どーん

f:id:s3ij1nn:20181205150509p:plain
screenfetch