Skip to content

Instantly share code, notes, and snippets.

View solidsnack's full-sized avatar

Jason Dusek solidsnack

  • Dallas, TX
  • 15:21 (UTC)
View GitHub Profile
@solidsnack
solidsnack / logtee.bash
Created June 9, 2015 22:52
Log STDOUT and STDERR to both syslog and the console.
#!/bin/bash
set -o errexit -o pipefail -o nounset
# Log STDOUT and STDERR to both syslog and the console.
exec 3>&1
exec 4>&2
exec 1> >(tee >(logger -p user.info) 1>&3)
exec 2> >(tee >(logger -p user.notice) 2>&4)
"$@"
data DNS: Type where
--- Should match /^([a-z0-9]([a-z0-9-]*[a-z0-9])?[.])+$/
UnRooted String : DNS
--- Should match /^[a-z0-9]([a-z0-9-]*[a-z0-9])?
--- ([.][a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/x
Rooted String : DNS
@solidsnack
solidsnack / 14.04-ebs.json
Last active May 27, 2016 23:33 — forked from sborsje/10.04-LTS-EBS.json
14.04-amd64-ebs.json
{
"AWSRegionArch2AMI": {
"ap-northeast-1": {
"amd64XhvmXebs": "ami-9e5cff9e",
"amd64XhvmXebsXio1": "ami-a05cffa0",
"amd64XhvmXebsXssd": "ami-a25cffa2",
"amd64XhvmXephemeral": "ami-de5efdde",
"amd64Xebs": "ami-925cff92",
"amd64XebsXio1": "ami-985cff98",
"amd64XebsXssd": "ami-9c5cff9c",
@solidsnack
solidsnack / s3ql.conf
Created February 4, 2015 05:32
Personal S3QL Upstart script (~/.config/upstart/s3ql.conf)
description "S3QL cloud filesystem"
start on desktop-start
stop on desktop-end
kill timeout 300
expect stop
env dir=...
env url=s3://...
@solidsnack
solidsnack / getQueryParams.js
Last active August 29, 2015 14:14 — forked from ryoppy/getQueryParams.js
Parse query string, accepting multiple parameters
/**
* Parse query string.
* ?a=b&c=d&e=f&e=g to {a: 'b', c: 'd', e: ['f', 'g']}
* @param {String} (optional) queryString
* @return {Object} query params
*/
getQueryParams: function(queryString) {
var query = (queryString || window.location.search).replace(/^[?]/, ''),
result = {};
if (!query) return result;
@solidsnack
solidsnack / notify
Created December 21, 2014 21:18
Run command and send a desktop notification on completion.
#!/bin/bash
set -o errexit -o nounset -o pipefail
function -h {
cat <<USAGE
USAGE: notify <command> <arg>*
Run command and send a desktop notification on completion.
The notification will indicate whether the command succeeded (exit code 0)
or failed. If the command fails, the exit code will be included in the
@solidsnack
solidsnack / t.md
Last active August 29, 2015 14:10
A notation for time intervals

The term "time interval" can refer to both a duration, like "one day", and a range of time between two set times; for example, the three days between now and next Monday.

We propose a new notation for both kinds of time intervals, based on the ISO 8601 date format.

To indicate a duration, an ISO 8601 format time preceded by a + or - is used.

@solidsnack
solidsnack / fbchat.js
Created November 24, 2014 19:56
Retrieve a Facebook chat transcript
/* Navigate to a Facebook chat ("See full conversation") and copy this code
* into the Chrome inspector to get a Facebook chat transcript copied to
* the clipboard. By default, the program produces plaintext (with newlines
* and no carriage returns). There is a JSON mode which you can uncomment
* to get structured data instead.
*/
function scanPageForMessages() {
var messages = document.querySelectorAll(".webMessengerMessageGroup"),
/** Format Dreamboard dreams as Markdown (and copy to clipboard);
*
* To use this file, navigate to https://dreamboard.com/dreams/ and open the
* Chrome or Firefox dev console. Paste in the whole file and your dreams
* will be copied to the clipboard in Markdown format (which can be processed
* any number of ways to make a printable document or presentable email).
*/
function Dream(title, timestamp, text) {
if (title instanceof HTMLElement) {
#!/bin/bash
set -o errexit -o nounset -o pipefail
# Process IDs in a given process group
function lspgid {
local process_group="$1"
ps -g "$process_group" -o pid=
}
lspgid "$@"