Skip to content

Instantly share code, notes, and snippets.

@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
@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 / 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 / colors.md
Last active October 6, 2021 18:13
Github Flavored Markdown (GFM) Colored text

Using diff: red/green monospaced text

+ Green.Like all Byzantine agreement protocols, SCP makes no assumptions about the rational behavior of attackers.
- Red. Like all Byzantine agreement protocols, SCP makes no assumptions about the rational behavior of attackers.
Black. Like all Byzantine agreement protocols, SCP makes no assumptions about the rational behavior of attackers.

Using code comments: gray text

@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 / 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 / __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 / 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 / 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 / child.html
Last active June 28, 2016 18:41
Iframe height sync
<html>
<head>
<!-- MAKE SURE THERE IS 0 PADDING OUTSIDE OF resizeWrapper-->
<style>
body, html {
padding: 0;
margin: 0;
}
</style>
</head>