Skip to content

Instantly share code, notes, and snippets.

View Fusl's full-sized avatar
🏳️‍🌈
🦊

Katie Holly Fusl

🏳️‍🌈
🦊
  • The Internet
  • In your walls
View GitHub Profile
@Fusl
Fusl / gist:e4589f652c49f8b6f06a
Last active August 29, 2015 14:02
topicsed irc bot
#!/usr/bin/env node
// Download http://lvogel.free.fr/jsed/jsed.js to "sed.js" and append "module.exports = sed;" to the end of the file.
var sed = require('./sed.js');
var irc = require('node-irc');
var fs = require('fs');
var historytopic = {};
var pretopic = {};
@Fusl
Fusl / keybase.md
Created July 6, 2014 14:04
keybase.md

Keybase proof

I hereby claim:

  • I am fusl on github.
  • I am fusl (https://keybase.io/fusl) on keybase.
  • I have a public key whose fingerprint is 09AE 48AC A8ED 6AB7 AD3C E306 B01A A8FD D0B7 3A4C

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am fusl on github.
  • I am fusl (https://keybase.io/fusl) on keybase.
  • I have a public key whose fingerprint is 09AE 48AC A8ED 6AB7 AD3C E306 B01A A8FD D0B7 3A4C

To claim this, I am signing this object:

@Fusl
Fusl / devvideo0.js
Last active January 13, 2018 21:01
quickndirty: serving a /dev/video0 webcam via network
#!/usr/bin/env ndoe
var devicepath = '/dev/v4l/by-id/usb-Hewlett_Packard_HP_Webcam_HD_4310-video-index0';
var devicefps = 15;
var width = 1280;
var height = 720;
var bufsize = 512 * 1024 * 1024; // 512 MiB (perfect for a RPi)
@Fusl
Fusl / umount.sh
Created February 5, 2018 06:24
recursive umount
findmnt -u -n -r -o TARGET -R /path/to/mountpoint/ | sort -r | tr '\n' '\0' | xargs -0 -r umount
@Fusl
Fusl / gist:e54e5eeabc3196c7a63dec6f9ab2bfda
Created February 25, 2018 03:14 — forked from cdown/gist:1163649
Bash urlencode and urldecode
urlencode() {
# urlencode <string>
old_lc_collate=$LC_COLLATE
LC_COLLATE=C
local length="${#1}"
for (( i = 0; i < length; i++ )); do
local c="${1:i:1}"
case $c in
[a-zA-Z0-9.~_-]) printf "$c" ;;
@Fusl
Fusl / getBasicAuthArray.js
Created April 26, 2018 16:11
Node.js/Javascript function to extract HTTP Basic auth from Authorization header string
const getBasicAuthArray = data => {
data = data.split(' ');
if (data.length !== 2 || !data[0].length || !data[1].length || data[0].toLowerCase() !== 'basic') return [null, null];
let basicAuthData = Buffer.from(data[1], 'base64').toString('utf8').split(':');
return [basicAuthData.shift(), basicAuthData.join(':')];
};
cat docker-compose.tyml | perl -pe 's/^(\t+)/" " x length($1)/gei' > docker-compose.yml
#!/bin/sh
# ./convert_ploop_to_simfs.sh VEID
# chmod +x convert_ploop_to_simfs.sh
rsync_options='-aHAX --progress --stats --numeric-ids --delete'
partition='vz'
if [ ! -e /etc/vz/conf/$1.conf ]; then
echo "Virtual server configuration file: /etc/vz/conf/$1.conf does not exist."
exit 1
fi
if [ ! -d /$partition/private/$1/root.hdd ]; then
@Fusl
Fusl / ruststats.js
Last active December 1, 2018 07:24
Rust server stats to InfluxDB
#!/usr/bin/env node
'use strict';
const Websocket = require('ws');
const async = require('async');
const Influx = require('influx');
const once = require('once');
const toml = require('toml');
const fs = require('fs');