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
package demo | |
import ( | |
"context" | |
) | |
type ProviderInterface interface { | |
MethodA(ctx context.Context, id int) error | |
MethodB(ctx context.Context, id int) error | |
MethodC(ctx context.Context, id int) error |
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 | |
# usage: | |
# run command | |
# $ cd your-repo | |
# $ curl -Ls https://gist.githubusercontent.com/dixudx/7d7edea35b4d91e1a2a8fbf41d0954fa/raw/prepare-commit-msg -o .git/hooks/prepare-commit-msg | |
# $ chmod +x .git/hooks/prepare-commit-msg | |
NAME=$(git config user.name) | |
EMAIL=$(git config user.email) |
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
package main | |
import ( | |
"encoding/json" | |
"flag" | |
"log" | |
"os" | |
"os/signal" | |
"syscall" | |
"time" |
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) |
NewerOlder