Skip to content

Instantly share code, notes, and snippets.

View ishan-marikar's full-sized avatar

Ishan Marikar ishan-marikar

View GitHub Profile
@ishan-marikar
ishan-marikar / chrome-cookies.sh
Last active August 29, 2015 14:26 — forked from nicerobot/chrome-cookies.sh
Convert Google Chrome sqlite Cookies into cookies.txt. Useful for utilities like curl.
sqlite3 -separator ' ' ${COOKIES:-Cookies} \
'select host_key, "TRUE", path, "FALSE", expires_utc, name, value from cookies'
@ishan-marikar
ishan-marikar / script.user.js
Last active August 29, 2015 14:26 — forked from jr-codes/script.user.js
Userscript Boilerplate
// ==UserScript==
// @name Userscript Name
// @namespace http://example.com/
// @description Userscript Description
// @match http://example.com/* (or @include * to include all pages)
// @version 1.0
// ==/UserScript==
// Emulate Greasemonkey's unsafeWindow in Chrome
window.unsafeWindow = window.unsafeWindow || (function() {

I use this function to setup / resume my tmux sessions. If a session exists with the given name it resumes it, otherwise it creates it:

tm() {
  [[ -z "$1" ]] && { echo "usage: tm <session>" >&2; return 1; }
  tmux has -t $1 && tmux attach -d -t $1 || tmux new -s $1
}

(N.b. If you use something similar already check you have the -d flag. This will kill old clients (e.g. ssh connections that died, quitting your terminal before disconnecting) and ensure the window resizes correctly.)

@ishan-marikar
ishan-marikar / tmux-cheatsheet.markdown
Last active September 2, 2015 18:09 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@ishan-marikar
ishan-marikar / install_ruby_rpi.sh
Last active September 4, 2015 15:39 — forked from blacktm/install_ruby_rpi.sh
A Bash script to install Ruby 2.2 on the Raspberry Pi (Raspbian).
#!/bin/bash
# -----------------------------------------------------------------------
# Installs Ruby 2.2 using rbenv/ruby-build on the Raspberry Pi (Raspbian)
#
# Run from the web:
# bash <(curl -s raw_script_url_here)
# -----------------------------------------------------------------------
# Set up variables
@ishan-marikar
ishan-marikar / tor-change-exitnode
Last active September 7, 2015 16:43 — forked from kirelagin/tor-change-exitnode
Shell script to force Tor exit node change
#!/bin/sh
###
#
# Change Tor exit node
#
# Sometimes when using Tor you'd like to change the IP address that
# servers see when you connect (that is, change your Tor exit node).
# This happens automatically from time to time, but this shell script
# lets you force it.
#
@ishan-marikar
ishan-marikar / gist:2ccffba17c73ab0847d6
Created September 23, 2015 06:06 — forked from anonymous/gist:55a8315d7cb96fc1e5ae
Morse.py script for xchat/hexchat. Automatically decode incoming morse to english. Automatically code text as morse when typing in certain channels. /morse command available.
# Morse.py script for xchat/hexchat
# - Automatically decode incoming morse to english
# - Automatically code text as morse when typing in certain channels
# - /morse <text> command sends morse in any channel
# - /morse /topic <text> works
# - /morse /kick person <texttomorse> works too
# Nothing pretty, just gets the job done.
# Take it, make it better, remove the magic numbers, add comments 'n' all dat.
@ishan-marikar
ishan-marikar / tmux.md
Created October 24, 2015 09:18 — forked from andreyvit/tmux.md
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@ishan-marikar
ishan-marikar / .jshintrc.js
Created November 5, 2015 09:33 — forked from connor/.jshintrc.js
jshintrc example
// NOTE: I added the .js extension to this gist so it would have syntax highlighting. This file should have NO file extension
{
// Settings
"passfail" : false, // Stop on first error.
"maxerr" : 100, // Maximum error before stopping.
// Predefined globals whom JSHint will ignore.
"browser" : true, // Standard browser globals e.g. `window`, `document`.
#!/bin/sh
remove_dangling() {
echo "Removing dangling images ..."
docker rmi $(docker images -f dangling=true -q)
}
remove_stopped_containers() {
echo "Removing stopped containers ..."
docker rm $(docker ps -qa)