Skip to content

Instantly share code, notes, and snippets.

View metakirby5's full-sized avatar
🍵

Ethan Chan metakirby5

🍵
View GitHub Profile
0484ca2609859308d59772a02b1ee0c6d014d367c315fe6d8965d791ff011a444b05ca5c8e8f1245c1b0173a49e46be8750a305bd37522c54ece22afdcfe46af4f;IsaiahN
@metakirby5
metakirby5 / fb_sticker_url_grabber.js
Created December 4, 2016 00:29
Facebook sticker URL grabber
// Open the sticker menu in a chat box, then paste this into the console.
// This will output a space-seperated and quoted list of sticker URLs.
// You can then download them with `wget`.
Array.prototype.map.call(document.getElementsByClassName('_5r8i'), (e) => {
return e.style.backgroundImage.slice(4, -1)
}).join(' ')
@metakirby5
metakirby5 / letsencrypt
Last active December 14, 2017 23:37
Automatically update letsencrypt certificate for all nginx domains
#!/usr/bin/env bash
# Updates nginx letsencrypt domains by server_name.
/opt/letsencrypt/letsencrypt-auto \
certonly -a webroot --webroot-path=/var/www/ssl \
$(grep -hro '^\s*server_name\s\+[a-zA-Z0-9.-]\+' /etc/nginx/ |
sort | uniq | awk '{print "-d", $2}')
@metakirby5
metakirby5 / keybase.md
Created August 22, 2016 08:34
Keybase Proof

Keybase proof

I hereby claim:

  • I am metakirby5 on github.
  • I am metakirby5 (https://keybase.io/metakirby5) on keybase.
  • I have a public key whose fingerprint is 32EC AE2C 76AB C51F 7FF8 8DAC 3930 78BC A9F2 EED8

To claim this, I am signing this object:

@metakirby5
metakirby5 / pty.py
Last active September 28, 2022 12:47
How to simulate user input on an interpreter using a Python's pty module
import os, sys, subprocess, pty, select, re
BUFSIZ = 1024
MAGIC = '\004\004' # ctrl-D x2
escape = re.compile(r'(\x9B|\x1B\[)[0-?]*[ -\/]*[@-~]')
data = '\n'.join([
'1 + 1',
'2000',
'(function() {})',
@metakirby5
metakirby5 / fix_safari_new_tab_hang.md
Last active July 2, 2016 08:46
Stop Safari hanging when selecting the address bar or opening a new tab

This shit has been bugging me for too long, so I went on a hunt and found a workaround.

The Symptoms are as follows:

  • Clicking the address bar results in a 1-4 second delay
  • Opening links in new tabs results in a 1-4 second delay
  • +T results in a 1-4 second delay
  • PressAndHold[<pid>]: IMKServer Stall detected is present in /var/log/system.log at the time of the hang.

It appears to be to do with the PressAndHold helper - the thing that shows an IOS style selection of accents when you hold a key down.

@metakirby5
metakirby5 / sVim.rc
Last active September 25, 2016 01:28
" Settings
let lastactivetablimit = 50;
let lastclosedtablimit = 50;
let blacklists = ["*://trello.com/*", "*://youtube.com/*", "*://inbox.google.com/*", "*://hackerrank.com/*"]
" Keys
let mapleader = "space"
map "up" scrollUp
map "down" scrollDown
map "left" scrollLeft
@-webkit-keyframes fadein {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
#sVim-command {
@metakirby5
metakirby5 / input.txt
Last active August 29, 2015 14:05
Maze Solution
._._._._._._._._._.E.
| ._._._. | . ._._. |
|_._. |_. |_| | . | |
|_. |_. |_._._| |_._|
| |_._._| . ._| |_. |
| ._._._. |_| ._| ._|
| | ._. |_| ._|_._. |
| ._| |_. |_._._. | |
|_._. | | | ._. |_. |
| ._|_. | | | |_. | |