Skip to content

Instantly share code, notes, and snippets.

@ssoriche
ssoriche / whiteboardCleaner.md
Created November 13, 2018 22:28 — forked from lelandbatey/whiteboardCleaner.md
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!

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

@ssoriche
ssoriche / gist:c8b45e899f9860736466bbd6518ed776
Created August 22, 2018 13:32 — forked from jkeroes/gist:a9ae6be73fc6106d9a1e
Perl and memory leak handling
## Memory leaks
Tracking memory leaks:
Devel::Arena - sv_stats() returns arena structures used for SV allocation
* Devel::Cycle - find_cycle($ref) returns all cycles found in $ref and the perl variables they point to
Devel::Gladiator - walk Perl variable arena
Devel::Leak - deprecated by Devel::LeakTrace::Fast
Devel::LeakTrace - deprecated by Devel::LeakTrace::Fast
* Devel::LeakTrace::Fast - prints leaked SV's and line numbers at END.
Data::Structure::Util - has_circular_ref($ref) returns ref to link in $ref that is circular or false.
@ssoriche
ssoriche / bling.js
Created April 21, 2018 22:50 — forked from paulirish/bling.js
bling dot js
/* bling.js */
window.$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn);
}
NodeList.prototype.__proto__ = Array.prototype;
@ssoriche
ssoriche / .vimrc
Created June 25, 2017 14:41 — forked from ericbn/.vimrc
Vim Powerline-like status line without the need of any plugin
" Statusline (requires Powerline font)
set statusline=
set statusline+=%(%{'help'!=&filetype?bufnr('%'):''}\ \ %)
set statusline+=%< " Where to truncate line
set statusline+=%f " Path to the file in the buffer, as typed or relative to current directory
set statusline+=%{&modified?'\ +':''}
set statusline+=%{&readonly?'\ ':''}
set statusline+=%= " Separation point between left and right aligned items
set statusline+=\ %{''!=#&filetype?&filetype:'none'}
set statusline+=%(\ %{(&bomb\|\|'^$\|utf-8'!~#&fileencoding?'\ '.&fileencoding.(&bomb?'-bom':''):'')
@ssoriche
ssoriche / autopgsqlbackup
Created May 26, 2017 14:42 — forked from matthewlehner/autopgsqlbackup
Auto PostgreSQL backup script.
#!/bin/bash
#
# PostgreSQL Backup Script Ver 1.0
# http://autopgsqlbackup.frozenpc.net
# Copyright (c) 2005 Aaron Axelsen <[email protected]>
#
# This script is based of the AutoMySQLBackup Script Ver 2.2
# It can be found at http://sourceforge.net/projects/automysqlbackup/
#
# The PostgreSQL changes are based on a patch agaisnt AutoMySQLBackup 1.9
@ssoriche
ssoriche / gist:f1392dfddb5992376f8107cc5b615786
Created May 4, 2016 18:50 — forked from zolrath/gist:2305333
tmux status line from wemux example.

For a tmux status line as seen in the example image for the wemux project: wemux

The session on the left in the example screen shot uses a patched font from the vim-powerline project. Inconsolata-dz, you beautiful creature.

To duplicate the left status line add the following lines to your ~/tmux.conf

set -g status-left-length 32
set -g status-right-length 150
@ssoriche
ssoriche / ffmpeg-2.8-defaultstreams.patch
Created December 14, 2015 22:41
Patch for FFMPEG to fix broken channel disabling behavior
diff -d -E -b -w -r -i -r -c ffmpeg-2.8.orig/libavformat/movenc.c ffmpeg-2.8/libavformat/movenc.c
*** ffmpeg-2.8.orig/libavformat/movenc.c 2015-09-08 21:17:47.000000000 -0400
--- ffmpeg-2.8/libavformat/movenc.c 2015-09-10 14:37:43.000000000 -0400
***************
*** 4831,4853 ****
st->codec->codec_type >= AVMEDIA_TYPE_NB)
continue;
if (first[st->codec->codec_type] < 0)
first[st->codec->codec_type] = i;
@ssoriche
ssoriche / parsel.sql
Created November 9, 2015 14:53
Parsel: A Simple Function for Parallel Query in Postgres using Dblink
-- DROP FUNCTION IF EXISTS public.parsel(db text, table_to_chunk text, pkey text, query text, output_table text, table_to_chunk_alias text, num_chunks integer);
CREATE OR REPLACE FUNCTION public.parsel(db text, table_to_chunk text, pkey text, query text, output_table text, table_to_chunk_alias text default '', num_chunks integer default 2)
RETURNS text AS
$BODY$
DECLARE
sql TEXT;
min_id integer;
max_id integer;
step_size integer;
lbnd integer;
// Node.js CheatSheet.
// Download the Node.js source code or a pre-built installer for your platform, and start developing today.
// Download: http://nodejs.org/download/
// More: http://nodejs.org/api/all.html
// 0. Synopsis.
// http://nodejs.org/api/synopsis.html
#!/bin/bash
FILES=`git ls-tree --name-only HEAD .`
MAXLEN=0
for f in $FILES; do
if [ ${#f} -gt $MAXLEN ]; then
MAXLEN=${#f}
fi
done
for f in $FILES; do