Skip to content

Instantly share code, notes, and snippets.

@irisli
irisli / imgcat.sh
Created Mar 8, 2019
Image cat from iTerm (i didn't write this. Just hosting this here)
View imgcat.sh
#!/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 Jan 9, 2018 — forked from addyosmani/headless.md
So, you want to run Chrome headless.
View headless.md

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 Dec 20, 2017 — forked from XVilka/TrueColour.md
True Colour (16 million colours) support in various terminal applications and terminals
View TrueColour.md

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 Mar 21, 2020
Github Flavored Markdown (GFM) Colored text
View colors.md

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 Oct 4, 2016 — forked from iamnewton/bash-colors.md
The entire table of ANSI color codes.
View bash-colors.md

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 Sep 20, 2016 — forked from danieleggert/GPG and git on macOS.md
How to set up git to use the GPG Suite
View GPG and git on macOS.md

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 Aug 20, 2018
UC Berkeley landmarks coordinates (longitude and latitude) in JSON format
View __UC Berkeley Landmarks.md

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 Jul 21, 2016
Run a background task and start it regularly
View looprunner.sh
while true
do
./run.sh &
sleep 3600
sudo pkill -INT python
sleep 5
done
@irisli
irisli / formfiller.js
Created Jul 2, 2016
Batch form filler
View formfiller.js
// 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 Jun 28, 2016
Iframe height sync
View child.html
<html>
<head>
<!-- MAKE SURE THERE IS 0 PADDING OUTSIDE OF resizeWrapper-->
<style>
body, html {
padding: 0;
margin: 0;
}
</style>
</head>