Skip to content

Instantly share code, notes, and snippets.

@ssoriche
ssoriche / builtin-keyboard-modifications.yaml
Created November 9, 2022 16:55
CAPSLOCK as ESC and CTRL
TIMING:
TAP_MILLISEC: 200
DOUBLE_TAP_MILLISEC: 150
MAPPINGS:
- KEY: KEY_CAPSLOCK
TAP: KEY_ESC
HOLD: KEY_LEFTCTRL
@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 / unblock_wireguard.sh
Created October 3, 2018 13:04
When running macOS firewall and wireguard installed from home-brew, the following script will open the firewall. Run after installation and every upgrade of `wireguard-tools` as the path to `wg-quick` will change.
#!/bin/bash
fix_wireguard() {
local fw='/usr/libexec/ApplicationFirewall/socketfilterfw'
local wg_sym="$(which wg-quick)"
local wg_abs="$(greadlink -f $wg_sym)"
sudo "$fw" --setglobalstate off
sudo "$fw" --add "$wg_sym"
sudo "$fw" --unblockapp "$wg_sym"
@ssoriche
ssoriche / tmux.conf
Created September 18, 2018 16:07
Using F12 to toggle top most bindings with nested TMUX
bind -T root F12 \
set prefix None \;\
set key-table off \;\
refresh-client -S
bind -T off F12 \
set -u prefix \;\
set -u key-table \;\
refresh-client -S
@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;
#!/usr/bin/env perl
use v5.22;
use feature qw(signatures);
no warnings qw(experimental::signatures);
use Getopt::Long;
use Carton::Snapshot;

Keybase proof

I hereby claim:

  • I am ssoriche on github.
  • I am ssoriche (https://keybase.io/ssoriche) on keybase.
  • I have a public key ASBDu_pa9ZE8qfxVPjAXpjSRZGi3_fwVxtUr6l1LntIVvQo

To claim this, I am signing this object:

@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 <axelseaa@amadmax.com>
#
# 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