Skip to content

Instantly share code, notes, and snippets.

@plainas
plainas / .py
Created December 16, 2018 23:01
hexstring to binstring
def hex2binstr(bstr):
t = {
"0" : '0000',
"1" : '0001',
"2" : '0010',
"3" : '0011',
"4" : '0100',
"5" : '0101',
#!/bin/bash
function F_get_instance_state {
aws ec2 describe-instances --instance-id $1 | jq -r ".Reservations[0].Instances[0].State.Name"
}
function F_get_volume_state {
aws ec2 describe-volumes --volume-ids $1 | jq -r ".Volumes[0].State"
}
@plainas
plainas / tmux.md
Created February 2, 2016 14:15 — 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

@plainas
plainas / Makefile
Last active August 29, 2015 14:21 — forked from isaacs/Makefile
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
@plainas
plainas / gist:1ab7df93444024d2724d
Created April 22, 2015 01:23
iadd ikill ishow
#######################################################
# iadd
#######################################################
#!/bin/sh
git ls-files -m |percol|xargs git add
#######################################################
# ikill
#######################################################
@plainas
plainas / bufferutils.js
Last active December 28, 2015 19:09
node.js crypto stuff, signing and verifying
var bufferXOR = function(a,b){
c = Buffer(20);
for(i = 0; i<20;i++){
c[i] = a[i] ^ b[i];
}
return c;
}
var getKBucketId = function(buf){
@plainas
plainas / emacs.el
Last active December 24, 2015 06:19
My .emacs files
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(custom-enabled-themes (quote (wombat))))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
@plainas
plainas / viewonflickriver.user.js
Created February 6, 2012 01:27
View on flickriver userscript
// ==UserScript==
// @name View on flifkriver
// @namespace http://lamehacks.net
// @description Adds links to flickriver on flickr group, user, tag and search pages
// @include http://*.flickr.com/*
// @match http://*.flickr.com/*
// ==/UserScript==
var groupRegex = new RegExp(".*?flickr.com/groups/([^\/]*)");
var matched = groupRegex.exec(window.location);