Skip to content

Instantly share code, notes, and snippets.

extern crate backend;
extern crate futures;
extern crate inotify;
use backend::prelude::*;
use backend::Buffer;
use futures::{Poll, Stream};
use inotify::INotify;
use std::path::PathBuf;
@passcod
passcod / dcloud.md
Last active May 24, 2016 02:40
Docker Cloud rant

I ranted about this on Twitter, @ah3rz advised me about these forums, so here goes, hoping the team sees it. Strong language ahead, I was (and still am) fairly upset.

Browser is Firefox, latest, on Arch Linux. Flash is not available, JS runs fine (I don't have noscript), I do have uBlock enabled with the default lists. Firefox's Tracking Protection doesn't detect (and block) anything. In the console, I see a bunch of HSTS errors, but it doesn't seem to be be affecting behaviour:

Strict-Transport-Security: The site specified a header that could not be parsed successfully.

Background: I use Docker Cloud both for managing my personal services (blog, various websites, irc bouncer, etc) and at work, for production and staging services, as well as a few ops tools. We have several dozen services across three nodes total, and probably will be doubling that in the next year. Not big, but not tiny, either.

@passcod
passcod / us
Created February 22, 2016 10:53
default partial alphanumeric_keys modifier_keys
xkb_symbols "basic" {
name[Group1]= "English (US)";
key <TLDE> { [ grave, asciitilde ] };
key <AE01> { [ 1, exclam ] };
key <AE02> { [ 2, at ] };
key <AE03> { [ 3, numbersign ] };
key <AE04> { [ 4, dollar ] };
@passcod
passcod / SO_34017416.rb
Created December 1, 2015 10:11
Stylistic suggestion for StackOverflow question 34017416
File.write("/etc/nginx/sites-available/#{domain}", "
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /usr/share/nginx/html;
index index.html index.htm;
server_name localhost;
location / {
try_files $uri $uri/ =404;
}
@passcod
passcod / 0_reuse_code.js
Created October 1, 2015 22:46
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console

ES6

The current version of JavaScript. We support "old" browsers, so we can't use it on the client side*, but we can totally use it server-side or in other environments where we have stricter control over the JS runtime.

ES6 has various new features:

'use strict'

Put it at the top of files to switch on "strict mode" which fixes various behaviours that have led developers over the ages to call JS "broken". For example, some comparisons, especially with NaN, undefined, and null; also disables the performance-hurting with keyword.

import Twitter from 'twitter';
const client = new Twitter({
consumer_key: process.env.TWITTER_CONSUMER_KEY,
consumer_secret: process.env.TWITTER_CONSUMER_SECRET,
access_token_key: process.env.TWITTER_ACCESS_TOKEN_KEY,
access_token_secret: process.env.TWITTER_ACCESS_TOKEN_SECRET
});
let getFaves = function () {
@passcod
passcod / coc
Last active August 29, 2015 14:23
#!/usr/bin/bash
file="CODE_OF_CONDUCT.md"
gitroot="$(git rev-parse --show-toplevel)"
if [[ -z "$gitroot" ]]; then
exit
fi
cd "$gitroot"
url="http://contributor-covenant.org/version/1/1/0/code_of_conduct.md"
rustc 1.0.0 (a59de37e9 2015-05-13) (built 2015-05-14)
binary: rustc
commit-hash: a59de37e99060162a2674e3ff45409ac73595c0e
commit-date: 2015-05-13
build-date: 2015-05-14
host: x86_64-unknown-linux-gnu
release: 1.0.0
1 A
1 A4
1 A5
1 A6
1 Aa
1 AA
1 ac3_bsi_offset
1 AC3header
1 accept
1 action_function