Skip to content

Instantly share code, notes, and snippets.

@bndw
bndw / gist:d6d1aad699e309eebe38
Last active October 17, 2018 09:04
802.11 Radiotap header filters
IEEE 802.11 Radiotap Capture header (radiotap)
radiotap.antenna Antenna
Unsigned 32-bit integer
Antenna number this frame was sent/received over (starting at 0)
radiotap.channel Channel
Unsigned 32-bit integer
802.11 channel number that this frame was sent/received on
radiotap.channel.freq Channel frequency
<?php
/*
* Takes a credit card number and ensures
* it contains the proper number of digits
* for the given card type.
*/
function isValidCreditCardNumber($cardNumber)
{
// First check that the card number

Create a new key

  • gpg --gen-key
  • gpg --export --armor <email for new key> > ~/Desktop/my-pubkey.asc

Import a friend's key

gpg --recv-key <key id>

Encrpyt a message with a friend's key

" run :help <command> for more information
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
@bndw
bndw / component.js
Created October 29, 2015 22:07
ember select-box component
import Ember from "ember";
export default Ember.Component.extend({
content: null,
selectedValue: null,
didInitAttrs(attrs) {
this._super(...arguments);
if (!this.get('content')) {
@bndw
bndw / docker_debian.md
Last active November 9, 2023 13:40
How to install an older version of Docker on Debian
@bndw
bndw / convert_old_safe.go
Created September 4, 2016 05:50
Converts an old format pick safe to the new format
package main
import (
"encoding/json"
"flag"
"fmt"
"os"
"github.com/bndw/pick/backends"
"github.com/bndw/pick/safe"
#!/bin/bash
#
# Reloads HAProxy and kills the old instances kept alive by open connections.
#
# Old HAProxy instances will only be killed if they're:
# * bound to ports in CHOPPABLE_PORTS
# * not the active HAProxy process, as defined by PID_FILE
CONF=/etc/haproxy/haproxy.cfg
PID_FILE=/run/haproxy.pid

Keybase proof

I hereby claim:

  • I am bndw on github.
  • I am bndw (https://keybase.io/bndw) on keybase.
  • I have a public key whose fingerprint is 82D0 479F 230B 9590 41E8 616F E333 623C BDB5 D958

To claim this, I am signing this object:

@bndw
bndw / readme.md
Last active May 20, 2023 02:32
go 1.10 encoding/json Decoder.DisallowUnknownFields

Go 1.10 was released today and an addition to the core library encoding/json package caught my eye

func (dec *Decoder) DisallowUnknownFields()

DisallowUnknownFields causes the Decoder to return an error when the destination is a struct and the input contains object keys which do not match any non-ignored, exported fields in the destination.

Godoc