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
$ URL="https://github.com/sharkdp/bat/releases/download/v0.9.0/bat-v0.9.0-x86_64-unknown-linux-musl.tar.gz" | |
$ TARPATH="$(basename $URL .tar.gz)/bat" | |
$ TO=~/bin | |
$ curl -fsSL $URL | tar xzf - -C $TO --transform="s,$(dirname $TARPATH)/,," $TARPATH |
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
$ python -m SimpleHTTPServer | |
Serving HTTP on 0.0.0.0 port 8000 ... |
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
# Replace the shell executing the script | |
$ ex - '+g/^#!/s,bash,zsh,' -cwq install.sh | |
# Comment all non-commentary lines | |
$ ex - '+g/^[[:space:]]*[^#]/s/^/#/' -cwq test.sh |
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
public static boolean isMyChannelId(Long employeeId, String channelId) { | |
assert(employeeId != null); | |
Matcher pattern = Pattern | |
.compile("user_(?<user1>[0-9]+)_user_(?<user2>[0-9]+)") | |
.matcher(channelId); | |
if (pattern.matches()) { | |
long user1 = Long.parseLong(pattern.group("user1")); | |
long user2 = Long.parseLong(pattern.group("user2")); |
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
$ RED=$(tput setaf 1) | |
$ GREEN=$(tput setaf 2) | |
$ RESET=$(tput sgr0) | |
$ echo "This is ${RED}red${RESET} and this is ${GREEN}green${RESET}" | |
$ echo $TERM | |
xterm-256color | |
$ infocmp $TERM | |
# Reconstructed via infocmp from file: /Users/miguel/.terminfo/78/xterm-256color |
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
echo -en "Directory ~/bin already exists, overwrite it? [Y/n]: " | |
read -n 1 action; echo | |
case "$action" in | |
'') ;& | |
[Yy]) rm -rf ~/bin;; | |
*) echo "Skipping directory ~/bin";; | |
esac |
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
$ docker image inspect -f 'CMD {{.Config.Cmd}}, ENTRYPOINT {{.Config.Entrypoint}}' postgres:9.4 | |
CMD [postgres], ENTRYPOINT [docker-entrypoint.sh] |
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
# Lowercase all html tags | |
$ ex - '+%s,<\(.*\)>,<\L\1>,' -cwq index.html |
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
$ docker container run -i db psql postgres -U postgres <<EOF | |
CREATE TABLE employee (id INTEGER PRIMARY KEY, name VARCHAR); | |
INSERT INTO employee VALUES (1, 'Miguel'); | |
INSERT INTO employee VALUES (2, 'Javier'); | |
EOF |
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
addons: | |
ssh_known_hosts: <deploy-host> | |
before_deploy: | |
- openssl aes-256-cbc -K $encrypted_<...>_key -iv $encrypted_<...>_iv -in deploy_rsa.enc -out /tmp/deploy_rsa -d | |
- eval "$(ssh-agent -s)" | |
- chmod 600 /tmp/deploy_rsa | |
- ssh-add /tmp/deploy_rsa |
OlderNewer