Skip to content

Instantly share code, notes, and snippets.

View kaihendry's full-sized avatar

Kai Hendry kaihendry

View GitHub Profile
@kaihendry
kaihendry / gist:3170423
Created July 24, 2012 14:53
This works well
x220:/srv/www/greptweet$ cat foo.cgi
#!/bin/bash
exec 2>&1
cat <<END
Cache-Control: no-cache
Content-Type: text/html
END
./foo-script.sh & disown
@ElectronicRU
ElectronicRU / dmenu_history.sh
Last active December 14, 2015 19:48
dmenu script for providing unlimited history sorted by number of uses/most recent use.
#!/bin/sh
if [ $# -lt 1 ] ; then
echo 1>&2 "usage: dmenu_history hist_file dmenu_opts..."
exit 1
fi
f="$1"
tf=`mktemp`
if ! [ -e "$f" ]; then touch "$f"; fi
shift
( sort -r -k 1,1 -n -s "$f" | cut -d' ' -f2- ; cat - ) | dmenu "$@" |

#GoPro HERO4 Black Wifi Hacking, ep 2

By Maelstrom Napalm, @odwdinc and Konrad Iturbe

###Status URL:

http://10.5.5.9/gp/gpControl/status

####Protune EV compensation: Value | URL

@NickSto
NickSto / gist:6920790
Last active July 11, 2017 15:44 — forked from rnorth/gist:2031652
Cookie-based authentication with nginx
worker_processes 1;
error_log logs/error.log;
events {
worker_connections 1024;
}
@marcoscaceres
marcoscaceres / webshare.md
Last active August 24, 2020 01:38
How we implemented web share

How we implemented Web Share

Written by: Marcos Cáceres Technical reviewers: Kagami Sascha Rosylight, Sid Vishnoi.

This post describes how we implemented the Web Share API in Gecko, which is exposed as a DOM API to the Web. As it can be challenging to know how to implement new features in Gecko, it's intended to serve as a reference guide for other Gecko developers who need to implement similar DOM APIs in the future. For the impatient, the final implementation is available in Phabricator.

Before you start - some general advice about how things work

The following subsections give some general advice about what you should expect as you embark on implementing a new DOM feature.

@brunoamaral
brunoamaral / copyright.html
Created May 31, 2020 09:24
Automatic Unsplash Copyright Shortcode for Hugo
var request = require('request');
var async = require('async');
var faker = require('faker');
var _ = require('lodash');
if (!process.env.PEAK_PERIOD_MINS) {
process.env.PEAK_PERIOD_MINS = '30';
}
var PEAK_PERIOD_MINS = parseInt(process.env.PEAK_PERIOD_MINS, 10) * 60 * 1000;
var MAX_CONCURRENT = parseInt(process.env.MAX_CONCURRENT, 10) || 100;
@idontwantcookies
idontwantcookies / arch-backup.sh
Last active February 5, 2022 12:54
Simple bash scripts to backup and restore several archlinux config files
# Storing installed package names
echo $(pacman -Qentq) > pacman.bak
echo $(pacman -Qemtq) > yay.bak
echo $(pacman -Qdq) > pacman-optdep.bak
# Global config
cp /etc/pacman.conf pacman.conf.bak
cp -r /etc/pacman.d/ pacman.d.bak
cp /etc/hosts hosts.bak
cp /etc/hostname hostname.bak
@tomfuertes
tomfuertes / make-website.sh
Last active August 26, 2022 21:54
create an s3 bucket, config website serving, create cloudfront distribution, sync local dir
#!/usr/bin/env bash
# To run:
# $ brew uninstall s3cmd && brew install s3cmd --HEAD
# $ s3cmd --configure # fill in w/ amazon account vars
# $ cd path/to/local/static/site
# $ wget https://gist.githubusercontent.com/tomfuertes/9175005/raw/make-website.sh
# $ bash make-website.sh
#
# NOTE: cfcreate takes ~15 minutes to run on AWS.
@jclosure
jclosure / bidirectional_clipboard.md
Last active February 8, 2023 21:01
Setup a bi-directional shared clipboard between client macos and linux server for remote terminal emacs.

Using netcat and ssh tunnels, create a shared clipboard allowing client and server clipboards to be fused

Serve pbcopy and pbpaste on Mac's localhost

NOTE: That we are making the assumption that the clipboards are sending and receiving UTF-8 encoded bytes

~/Library/LaunchAgents/pbcopy.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">