Skip to content

Instantly share code, notes, and snippets.

@sanx
sanx / htsg_operations_log.sql
Created March 27, 2018 22:04
htsg_operations_log.sql
CREATE TABLE `htsg_operations_log` (
`id` bigint(20) unsigned NOT NULL,
`namespace` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL,
`name` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL,
`operation` varchar(16) COLLATE utf8mb4_unicode_ci NOT NULL,
`txnid` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL,
`status` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
`create_date` bigint(20) unsigned NOT NULL,
`update_date` bigint(20) unsigned NOT NULL,
PRIMARY KEY (`id`),
@sanx
sanx / tmux_cheatsheet.markdown
Created February 10, 2017 21:59 — forked from henrik/tmux_cheatsheet.markdown
tmux cheatsheet

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@sanx
sanx / functional-utils.js
Created June 7, 2016 04:06 — forked from bendc/functional-utils.js
A set of pure and immutable ES2015 functions aimed to make functional JavaScript more idiomatic.
// array utils
// =================================================================================================
const combine = (...arrays) => [].concat(...arrays);
const compact = arr => arr.filter(Boolean);
const contains = (() => Array.prototype.includes
? (arr, value) => arr.includes(value)
: (arr, value) => arr.some(el => el === value)
@sanx
sanx / GIF-Screencast-OSX.md
Created February 2, 2016 18:20 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@sanx
sanx / geraruro
Created October 21, 2015 21:25
geraruro
geraruro
@sanx
sanx / gist:922a5b314ae7368d936d
Created July 22, 2014 02:02
rotate 2 dimensional bitmap in JavaScript
var rotate90 = function (orig) {
var rotated = [];
for (var colIdx = 0; colIdx < orig[0].length; colIdx++) {
var reverseCol = [],
col;
for (var rowIdx = 0; rowIdx < orig.length; rowIdx++) {
reverseCol.push(orig[rowIdx][colIdx]);
}
col = reverseCol.reverse();
rotated.push(col);

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert $1 -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 $2

Results

@sanx
sanx / gist:8428043
Created January 14, 2014 23:30
get lengths of the strings following a "=" sign on all anchor elements in a page, sorted by descending string length
Array.prototype.slice.call(document.querySelectorAll("a")).map(function(a){return a.href.split('=')[1].length}).sort().reverse();
# download latest libevent2 and tmux sources, and extract them somewhere
# (thx bluejedi for tip on latest tmux URL)
#
# at the time of writing:
# https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
# http://sourceforge.net/projects/tmux/files/latest/download?source=files
#
# install deps
yum install gcc kernel-devel make ncurses-devel