This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'active_model_serializers' | |
module ActiveModelSerializers | |
module Adapter | |
class Toastio < Base | |
def serializable_hash(options = nil) | |
@__options = options = serialization_options(options) | |
json = Attributes.new(serializer, instance_options).serializable_hash(options) | |
serialized_hash = { :data => json } | |
serialized_hash[:success] = success |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo yum install -y yum-utils | |
sudo yum-config-manager \ | |
--add-repo \ | |
https://download.daocloud.io/docker/linux/centos/docker-ce.repo | |
sudo yum install -y -q --setopt=obsoletes=0 docker-ce-17.03.2.ce* docker-ce-selinux-17.03.2.ce* | |
sudo systemctl enable docker | |
sudo systemctl start docker | |
sudo service docker status |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get install libcap2-bin | |
sudo setcap 'cap_net_bind_service=+ep' $(readlink -f $(which node)) | |
node ./app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ssh -f -L <local-port>:<rds-address>:<rds-port> <jump_server> -N # run in background | |
mysql -u<rds-username> -P <local-port> --host='127.0.0.1' -p | |
psql -h 127.0.0.1 -p <local-port> -U <username> <db_name> # after entered input your password | |
## lsof 列出建立TCP链接到 xx port的 相关进程 | |
lsof -n -i4TCP:<portno> | grep <process-id> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias pbcopy="xclip -selection clipboard" | |
## dependencies resolver only for ubuntu LTS | |
```bash | |
sudo apt-get install xclip | |
``` | |
```bash | |
alias pbcopy="xclip -selection clipboard" | |
alias say="echo $1 | espeak" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Modeline and Notes { | |
" vim: set sw=4 ts=4 sts=4 et tw=78 foldmarker={,} foldlevel=0 foldmethod=marker spell: | |
" | |
" __ _ _____ _ | |
" ___ _ __ / _/ |___ / __ __(_)_ __ ___ | |
" / __| '_ \| |_| | |_ \ _____\ \ / /| | '_ ` _ \ | |
" \__ \ |_) | _| |___) |_____|\ V / | | | | | | | | |
" |___/ .__/|_| |_|____/ \_/ |_|_| |_| |_| | |
" |_| | |
" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mkdir ~/.npm-global | |
npm config set prefix '~/.npm-global' | |
echo "export PATH=~/.npm-global/bin:$PATH" >> ~/.zshrc | |
source ~/.zshrc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# tcpdump usage recipes: | |
# tcpdump -i <interface> <BPF: Berkeley Packet Filter> [options] | |
sudo tcpdump -i lo0 '(host localhost) and (port 4399)' -vvv -tt 4 | |
# watch with pipe chain command | |
watch -cd 'netstat -tan | head -n2; netstat -tan | sort | egrep 4399' | |
# netstat usage recipes: | |
# netstat [options] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat file.log | grep 'matcher' | |
export line_number=12333 | |
sed -n '${line_number},$p' file.log | less |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
initdb -D /usr/local/var/postgres # create database cluster directory for postgresql | |
createuser -s postgres # create postgre role |