Skip to content

Instantly share code, notes, and snippets.

@irisli
irisli / 1-setupRaid.sh
Last active June 28, 2016 18:48
RAID setup for EC2 instances with ephemeral instance storage
# 8 disk raid 0
# sudo mdadm --create --verbose /dev/md0 --level=0 --name=EPHEMERAL_RAID --raid-devices=8 /dev/xvdb /dev/xvdc /dev/xvdd /dev/xvde /dev/xvdf /dev/xvdg /dev/xvdh /dev/xvdi
@irisli
irisli / formfiller.js
Created July 2, 2016 01:03
Batch form filler
// Batch form filler to be used in the console
formValues = [
['foo','bar'],
['bar','baz'],
['baz','blah'],
['blah','blahblah'],
['wibble','wobble'],
['flob','wubble'],
]
@irisli
irisli / looprunner.sh
Created July 21, 2016 16:50
Run a background task and start it regularly
while true
do
./run.sh &
sleep 3600
sudo pkill -INT python
sleep 5
done
@irisli
irisli / GPG and git on macOS.md
Created September 20, 2016 22:08 — forked from danieleggert/GPG and git on macOS.md
How to set up git to use the GPG Suite

GPG and git on macOS

Setup

No need for homebrew or anything like that. Works with https://www.git-tower.com and the command line.

  1. Install https://gpgtools.org -- I'd suggest to do a customized install and deselect GPGMail.
  2. Create or import a key -- see below for https://keybase.io
  3. Run gpg --list-secret-keys and look for sec, use the key ID for the next step
  4. Configure git to use GPG -- replace the key with the one from gpg --list-secret-keys
@irisli
irisli / bash-colors.md
Created October 4, 2016 04:07 — forked from iamnewton/bash-colors.md
The entire table of ANSI color codes.

Regular Colors

Value Color
\e[0;30m Black
\e[0;31m Red
\e[0;32m Green
\e[0;33m Yellow
\e[0;34m Blue
\e[0;35m Purple
@irisli
irisli / git-cheatshsheet.bash
Last active February 8, 2017 23:59
Git cheatsheet
# Do this thing in order
# First, you should set up your ssh keys for github. If not, then you'll have to type a usenrame and password every time
# https://help.github.com/articles/generating-ssh-keys
# CD into where you want to store this project
# Adding the repository for the first time
# With ssh keys
git clone git@github.com:irisli/61b-network.git
@irisli
irisli / TrueColour.md
Created December 20, 2017 22:03 — forked from XVilka/TrueColour.md
True Colour (16 million colours) support in various terminal applications and terminals

Colours in terminal

It's a common confusion about terminal colours... Actually we have this:

  • plain ascii
  • ansi escape codes (16 colour codes with bold/italic and background)
  • 256 colour palette (216 colours + 16 ansi + 24 gray) (colors are 24bit)
  • 24bit true colour ("888" colours (aka 16 milion))
printf "\x1b[${bg};2;${red};${green};${blue}m\n"
@irisli
irisli / headless.md
Created January 9, 2018 21:19 — forked from addyosmani/headless.md
So, you want to run Chrome headless.

Update May 2017

Eric Bidelman has documented some of the common workflows possible with headless Chrome over in https://developers.google.com/web/updates/2017/04/headless-chrome.

Update

If you're looking at this in 2016 and beyond, I strongly recommend investigating real headless Chrome: https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md

Windows and Mac users might find using Justin Ribeiro's Docker setup useful here while full support for these platforms is being worked out.

@irisli
irisli / __UC Berkeley Landmarks.md
Last active August 20, 2018 20:27
UC Berkeley landmarks coordinates (longitude and latitude) in JSON format

UC Berkeley landmarks coordinates (longitude and latitude) in JSON format

The js script converts xml files from the UC Berkeley website's map.

These may be outdated. Run the script yourself to get the latest data.

I do not own this data. I am simply converting the data between formats.

@irisli
irisli / imgcat.sh
Created March 8, 2019 22:19
Image cat from iTerm (i didn't write this. Just hosting this here)
#!/bin/bash
# tmux requires unrecognized OSC sequences to be wrapped with DCS tmux;
# <sequence> ST, and for all ESCs in <sequence> to be replaced with ESC ESC. It
# only accepts ESC backslash for ST. We use TERM instead of TMUX because TERM
# gets passed through ssh.
function print_osc() {
if [[ $TERM == screen* ]] ; then
printf "\033Ptmux;\033\033]"
else