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] | |
# ... | |
echo-remote-proto-and-host = "!f(){ REMOTE=origin; git remote -v | grep $REMOTE | head -n1 | sed -E \"s/^$REMOTE\\t+([a-z]+):\\/\\/([^\\/]+).*/protocol=\\1\\nhost=\\2/\";};f" | |
clear-credentials = "!f(){ git echo-remote-proto-and-host | git credential-osxkeychain erase ;};f" | |
get-credentials = "!f(){ git echo-remote-proto-and-host | git credential-osxkeychain get ;};f" | |
update-password = "!f(){ (git echo-remote-proto-and-host; git get-credentials) | sed \"s/password=.*/password=$1/\" | git credential-osxkeychain store ;};f" | |
# Usage: | |
#. Copy your new password in clipboard |
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
git branch -r | cut -d '/' -f 2- | grep -v '\->' | sort -u | while read branch; do [[ "$(git --no-pager log -n 1 --format='%ae' "origin/$branch" 2>/dev/null)" == "$(git config user.email)" ]] && echo $branch; done |
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
## encrypt text with SSH key | |
# Notes: | |
# It's not as straightforward as someone would think! | |
# Need to convert the keys to an openssl known format (PEM) first. | |
# Also, SSH keys aren't meant to encrypt content larger than 200bytes | |
# Sources: | |
# https://superuser.com/questions/576506/how-to-use-ssh-rsa-public-key-to-encrypt-a-text | |
# https://serverfault.com/questions/706336/how-to-get-a-pem-file-from-ssh-key-pair | |
# https://superuser.com/questions/1679344/for-valid-pem-i-get-unable-to-load-private-key-by-openssh |
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
import datetime | |
import random | |
from grandfatherson import to_keep, to_delete, MONDAY | |
import pytz | |
# Install notes: | |
# require grandfatherson & pytz - pip3 install grandfatherson pytz | |
utc=pytz.UTC | |
now = datetime.datetime.now().replace(tzinfo=utc) # ensure TZ aware |
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
# Run 3 nodes | |
for i in 1 2 3; do | |
nod="n$i" | |
mkdir $nod | |
echo "$nod" >> $nod/index.html | |
docker run -d --name $nod -p 888${i}:80 -v `pwd`/${nod}:/usr/share/nginx/html:ro nginx | |
done | |
# Run a router proxy node | |
docker run --rm --name router -p 8888:80 -v `pwd`/default.conf:/etc/nginx/conf.d/default.conf nginx |
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
FROM node:6 | |
RUN apt-get update && apt-get -y install cron | |
RUN mkdir /app | |
ADD test.js /app | |
# Add crontab file in the cron directory | |
ADD crontab /etc/cron.d/hello-cron |
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
FROM busybox | |
COPY data/BUILD_REV / |
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 my-file | curl https://snappass.nurun.com.au -s --data "password=$(cat - | perl -p -e 's/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg')&ttl=1+day" | grep 'password-link.*readonly' | sed -E 's/.*"(http[^"]*)".*/\1/' |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Title</title> | |
<meta charset="utf-8"> | |
<style> | |
@import url(https://fonts.googleapis.com/css?family=Yanone+Kaffeesatz); | |
@import url(https://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic); | |
@import url(https://fonts.googleapis.com/css?family=Ubuntu+Mono:400,700,400italic); |
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/bash | |
aws_credentials_file=${HOME}/.aws/credentials | |
script_name=`basename $0` | |
error(){ | |
echo "[${script_name}] Error: $@. Exiting." | |
exit 1 | |
} |
NewerOlder