Skip to content

Instantly share code, notes, and snippets.

View brianloveswords's full-sized avatar
💭
computering

Brian J Brennan brianloveswords

💭
computering
View GitHub Profile
while inotifywait -e MODIFY -r $HOME 2> /dev/null
do
bundle exec nanoc compile
done;

I have two directories that look like this:

$ ls
dirA/ dirB/

$ ls dirA
bg_BG/  cs_CZ/  de_DE/  el_GR/  en_AU/  en_GB/  en_PH/  en_PL/	en_SG/  en_US/  es_AR/
es_ES/  es_MX/  fr_FR/  hu_HU/  id_ID/  it_IT/  ja_JP/  ko_KR/	ms_MY/  nl_NL/  pl_PL/
pt_BR/  pt_PT/  ro_RO/  ru_RU/  th_TH/  tr_TR/  vn_VN/  zh_CN/	zh_MY/  zh_TW/

Notes on systemd vs upstart

General notes

  • systemd is very well adopted across linux distros and is becoming the default for Debian and Ubuntu sometime in the next year.
  • Upstart is the default for Ubuntu 14.04 LTS and that’s what we currently deploy to.
    • It is not super trivial to change 14.04 LTS to use to systemd
    • It is pretty trivial to change 14.10 to use systemd, but I’m not sure we want to deploy to that.
$(cd /tmp && curl -H "Host: brooklynjs.com" 23.235.39.133 > brooklynjs.html && $(command -v open > /dev/null && which open || which xdg-open) brooklynjs.html && sleep 3 && rm brooklynjs.html)
// ==UserScript==
// @name SJW→skeleton
// @namespace http://bjb.io
// @include http://reddit.com/*
// @include https://reddit.com/*
// @include http://8chan.co/*
// @include https://8chan.co/*
// @include https://archive.today/*
// @version 1
// @grant none
/* Problem: Notifying clients of an error after headers have been sent
In normal HTTP buffer-everything-then-send, you would be able to
set an error status code, either 4xx or 5xx, to let the client know
that something has gone awry.
However when using a streaming interface the headers, including the
status code, are sent before it is known that the message will
finish sending successfully. With streams, the header can't be
trusted to determine the success/failure state of the message.
pub fn i64_as_bytes_be(n: i64) -> Vec<u8> {
let mut vec = Vec::with_capacity(8);
vec.push(((n & 0xff00000000000000) >> 56) as u8);
vec.push(((n & 0x00ff000000000000) >> 48) as u8);
vec.push(((n & 0x0000ff0000000000) >> 40) as u8);
vec.push(((n & 0x000000ff00000000) >> 32) as u8);
vec.push(((n & 0x00000000ff000000) >> 24) as u8);
vec.push(((n & 0x0000000000ff0000) >> 16) as u8);
vec.push(((n & 0x000000000000ff00) >> 8) as u8);
vec.push(((n & 0x00000000000000ff)) as u8);
extern crate debug;
struct Point {
x: f64,
y: f64
}
enum Shape {
Circle(Point, f64),
Rectangle(Point, Point)
{"hi":"lol"}