Skip to content

Instantly share code, notes, and snippets.

View danwakefield's full-sized avatar
🤠
Probably breaking something.

Daniel Wakefield danwakefield

🤠
Probably breaking something.
View GitHub Profile

OpenStack Style Guidelines

OpenStack has a set of style guidelines for clarity. OpenStack is a very large code base (over 1 Million lines of python), spanning dozens of git trees, with over a thousand developers contributing every 12 months. As such common style helps developers understand code in reviews, move between projects smoothly, and overall make the code more maintainable.

Step 0

@danwakefield
danwakefield / main.go
Last active August 29, 2015 14:18 — forked from creack/main.go
package main
import (
"crypto/rand"
"flag"
"fmt"
"io"
"log"
"net"
"os"
Just some stuff you might like to read / watch on the plane if you are interested.
OP-ED:
http://www.evanmiller.org/four-days-of-go.html
Video:
https://youtu.be/elu0VpLzJL8 -- Go for pythonista's -- 51m
https://youtu.be/woCg2zaIVzQ -- Concurrency + Composition -- 14m
https://youtu.be/B-r3Wf_I2Lk -- General stuff -- 18m
https://www.youtube.com/playlist?list=PLMW8Xq7bXrG58Qk-9QSy2HRh2WVeIrs7e -- Others
@danwakefield
danwakefield / index.html
Last active December 22, 2015 15:29
Password toggle with FontAwesome
<html>
<head>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
<script>
var createPasswordToggle = function(toggleTriggerId, passwordId) {
var changeInput = function(old, newType) {
// http://stackoverflow.com/a/9094151
var n = document.createElement('input');
n.type = newType;
if(old.size) n.size = old.size;
@danwakefield
danwakefield / main.js
Last active December 23, 2015 13:34
Prevent backspace page redirect with vanilla javascript
function preventBackspace() {
function matchesSelector_(el, selector) {
return (el.matches || el.msMatchesSelector).call(el, selector);
}
function prevent(e) {
if (e.which === 8) { // Backspace
if (!matchesSelector_(e.target, 'input:not([readonly]):not([type=radio]):not([type=checkbox]), textarea, [contentEditable], [contentEditable=true]')) {
e.preventDefault();
}
}
Verifying that +danielwakefield is my blockchain ID. https://onename.com/danielwakefield
@danwakefield
danwakefield / fnmatch.go
Created March 27, 2016 20:53 — forked from lilyball/fnmatch.go
fnmatch implementation for Go
// Provide string-matching based on fnmatch.3
package fnmatch
// There are a few issues that I believe to be bugs, but this implementation is
// based as closely as possible on BSD fnmatch. These bugs are present in the
// source of BSD fnmatch, and so are replicated here. The issues are as follows:
//
// * FNM_PERIOD is no longer observed after the first * in a pattern
// This only applies to matches done with FNM_PATHNAME as well
// * FNM_PERIOD doesn't apply to ranges. According to the documentation,
@danwakefield
danwakefield / ed25519-cert.pub
Last active March 26, 2017 20:14
ed25519.pub
ssh-ed25519-cert-v01@openssh.com AAAAIHNzaC1lZDI1NTE5LWNlcnQtdjAxQG9wZW5zc2guY29tAAAAILfZFL+Sc2QwVYljr+679F2u7l3dCt1W+yHpwKtfk31XAAAAIMWYZwqrMlekLqZnjCq5HA4OPuvRKMtBE7AAuB54McXBAAAAAAAAAAAAAAABAAAAIVNpZ25lZCBrZXkgZm9yIEdDIC0gRXhwOiBNYXIgMjAxOAAAAAgAAAAEYWRteAAAAABY1s8gAAAAAFqXQoAAAAAAAAAAggAAABVwZXJtaXQtWDExLWZvcndhcmRpbmcAAAAAAAAAF3Blcm1pdC1hZ2VudC1mb3J3YXJkaW5nAAAAAAAAABZwZXJtaXQtcG9ydC1mb3J3YXJkaW5nAAAAAAAAAApwZXJtaXQtcHR5AAAAAAAAAA5wZXJtaXQtdXNlci1yYwAAAAAAAAAAAAABFwAAAAdzc2gtcnNhAAAAAwEAAQAAAQEAtUbVYENqorKEn5Q78AqqLR90+T5zIA+NVz7jxuAO8/7eipFfK5UPzZMyObTGl1h/uas0TNcWQcn7vLkggYwMN2ssdjIvW0qMmoLkZq8Tu7lfEVQxxqM+YR93LWJJcIk0lOIdr3QvCD+1dZFQCqiu38RyDmaO09f5iVFUxXhnEx2zt0z/jQh3Xy7aEz9XEmvK6sfLhYkp6ViIvWWVLPJZgYKuoeDiNhHLrFiGqK9g+/Xx2HfCaqcvORcIUs0lYMauP4jOKaL4eEmKSAyAuZp0uSkfMKF2WG/X+IE8elCiBK59PKau34N8qvuhd2UBFpHzlVoIzA2+/UrGn/KXuHahiwAAAQ8AAAAHc3NoLXJzYQAAAQA1p3Jle8BkkFh/ruKL5ua19l8jf9ZTzb3+Re3+0gqfa7Rfxr8ADRdMI971BvmbeTROYprnxzOd32AepWjkvZtTP1KusePp+NKFpWkKkQeMx9eg7Cot0auU6vy5UVHQPGpqaPaCqpXfMz5whv6XP5Xxhzo
1 2 diff wanted result
A A A
B < B
C C C
D > D

Which Shell to Use

Bash is the only shell scripting language permitted for executables.

Executables must start with #!/bin/bash and a minimum number of flags. Use set to set shell options so that calling your script as bash <script_name> does not break its functionality.