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
curl --include \ | |
--no-buffer \ | |
--header "Connection: Upgrade" \ | |
--header "Upgrade: websocket" \ | |
--header "Host: example.com:80" \ | |
--header "Origin: http://example.com:80" \ | |
--header "Sec-WebSocket-Key: SGVsbG8sIHdvcmxkIQ==" \ | |
--header "Sec-WebSocket-Version: 13" \ | |
http://example.com:80/ |
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
#!/bin/sh | |
#Check the Drive Space Used by Cached Files | |
du -sh /var/cache/apt/archives | |
#Clean all the log file | |
#for logs in `find /var/log -type f`; do > $logs; done | |
logs=`find /var/log -type f` | |
for i in $logs |
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
# Retry a command up to a specific numer of times until it exits successfully, | |
# with exponential back off. | |
# | |
# $ retry 5 echo Hello | |
# Hello | |
# | |
# $ retry 5 false | |
# Retry 1/5 exited 1, retrying in 1 seconds... | |
# Retry 2/5 exited 1, retrying in 2 seconds... | |
# Retry 3/5 exited 1, retrying in 4 seconds... |
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
# Adapted from solution provided by http://stackoverflow.com/users/57719/chin-huang http://stackoverflow.com/a/31465939/348868 | |
# Scenario: You want to add a group to the list of the AllowGroups in ssh_config | |
# before: | |
# AllowGroups Group1 | |
# After: | |
# AllowGroups Group1 Group2 | |
- name: Add Group to AllowGroups | |
replace: | |
backup: yes |
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
1. Copy 'git-sync-fork' script code from gist | |
2. Create a file called 'git-sync-fork' in any 'bin' directory in your $PATH | |
3. Paste script into this new file 'git-sync-fork' and save | |
4. Make the file executable `chmod +x git-sync-fork` | |
5. Run the script inside your locally forked git repo | |
Example: | |
git-sync-fork upstream origin |
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
# Print date & time in JST time zone | |
# For Python 2.7.x without pytz module | |
import datetime | |
from datetime import datetime, timedelta, tzinfo | |
class JST(tzinfo): | |
def utcoffset(self, dt): | |
return timedelta(hours=9) |
- Install Go for Linux the usual way on your main Linux box:
cd
wget https://storage.googleapis.com/golang/go1.6.2.linux-amd64.tar.gz
tar -zxvf go1.6.2.linux-amd64.tar.gz
sudo mv go /usr/local/
export GOROOT=/usr/local/go
mkdir -p ~/gitwork/go/src
mkdir ~/gitwork/go/bin
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
set-window-option -g utf8 on | |
set -g mode-mouse on | |
set -g mouse-resize-pane on | |
set -g mouse-select-pane on | |
set -g mouse-select-window on | |
set-option -g prefix C-q | |
set -g history-limit 50000 | |
unbind-key C-b | |
bind-key q send-prefix | |
set -g base-index 1 |
NewerOlder