Skip to content

Instantly share code, notes, and snippets.

View t3hmrman's full-sized avatar

Victor Adossi ("vados") t3hmrman

View GitHub Profile
@t3hmrman
t3hmrman / fixtures.js
Created May 19, 2014 04:48
NodeJS Test fixtures for RethinkDB
/* Test fixtures and example objects for various tests to use */
var os = require('os'),
fs = require('fs'),
temp = require('temp'),
u = require('underscore'),
portfinder = require('portfinder'),
child_process = require('child_process'),
Q = require('q'),
rdb = require('rethinkdb'),
@t3hmrman
t3hmrman / utf8-quoted-printable-decode.js
Created November 16, 2014 02:26
Simple UTF-8 Quoted Printable decoder
/**
* Decode a UTF-8 quoted printable string into a UTF8 string
*
* @param {string} str - UTF quoted printable string (ex. "=E8=97=A4=E6=A3=AE")
*/
function utf8QuotedPrintableDecode(str) {
// Grab the ascii bytes separated by "=", trim first/last elements if empty
var asciiHex = str.split(/=+/);
if (asciiHex[0] === "") { asciiHex.shift(); }
if (asciiHex[asciiHex.length - 1] === "") { asciiHex.pop(); }
@t3hmrman
t3hmrman / test.js
Created September 28, 2015 07:58
Some random JS code
var txt = "This is some example text";
@t3hmrman
t3hmrman / moz-reload-mode.el
Last active February 23, 2016 01:19
Reload firefox on save or modification of a file
(require 'moz)
;; This gist is just a combination of two gists that @nonsequitur thought up in 2010:
;; https://gist.github.com/nonsequitur/442376
;; https://gist.github.com/nonsequitur/666092
;; One-line change was made to support recent emacs requirement of 'provide' function (@ bottom)
;;; Usage
;; Run M-x moz-reload-mode to switch moz-reload on/off in the
;; current buffer.
@t3hmrman
t3hmrman / headset-ctl.py
Last active July 6, 2021 07:20
Small script to bind to VolumeDown wheel on Logitech G930 (or other) Headsets with alsa
#!/bin/env python
# This script assumes a ton of facts about your system:
# 1) You're using a Logitech G930 (you can change this below)
# 2) aplay is installed and available on the PATH
# 3) amixer is installed and available on the path
import subprocess as sp
import re