Skip to content

Instantly share code, notes, and snippets.

View wwalker's full-sized avatar

Wayne Walker wwalker

View GitHub Profile
class Hamming
def self.compute(a, b)
[a, b].min.size.times.count {
|i| a[i] != b[i]
}
end
end
class Hamming
@wwalker
wwalker / README.md
Created May 2, 2016 18:04 — forked from jordansissel/README.md
Sorting windows in tmux by hostname.

For this to work, it requires my tmux fork that includes what I use as the hostname in the window list.

At any rate, it'll sort my tmux sessions alphabetically by the host I'm using.

my tmux fork: https://github.com/jordansissel/tmux

Starts with:

(0) -    nightfall: zsh - /home/jls/projects/tmux/trunk                                                            

(1) carrera: screen -x irc

@wwalker
wwalker / flock.go
Created April 29, 2016 21:00 — forked from ericchiang/flock.go
Golang Flock
package main
// #include <sys/file.h>
import "C"
import (
"fmt"
"os"
"os/exec"
)
@wwalker
wwalker / outline
Created March 15, 2016 17:10
setup i3 with xfc4 doing the grunt work
*set up an xfce4 sesssion (or the xubuntu session on xubuntu)
*run xfce4-session-settings
*Under Application Autostart
** Add -> i3, i3, i3
** Verify that i3 is now to autostart
* Under Session
** turn off (click on value in right column, select never)
*** xfwm4
*** xfce4-panel
*** other things as you desire
alskdjflkjadslfkj
@wwalker
wwalker / git-output
Last active January 9, 2016 01:04
merged but not??
wwalker@hatter:~/golang_workspace/src/gophers/libencryptedtokens (master u= origin/master)$ git merge jira/DEVOPS-308
Already up-to-date.
wwalker@hatter:~/golang_workspace/src/gophers/libencryptedtokens (master u= origin/master)$ git branch -d jira/DEVOPS-308
warning: not deleting branch 'jira/DEVOPS-308' that is not yet merged to
'refs/remotes/origin/jira/DEVOPS-308', even though it is merged to HEAD.
error: The branch 'jira/DEVOPS-308' is not fully merged.
If you are sure you want to delete it, run 'git branch -D jira/DEVOPS-308'.
wwalker@hatter:~/golang_workspace/src/gophers/libencryptedtokens (master u= origin/master)$
wwalker@hatter:~/golang_workspace/src/gophers/libencryptedtokens (master u= origin/master)$ git lg --all
@wwalker
wwalker / test
Created January 4, 2016 00:24
mysql.grants
mysql> show grants for powerdns;
ERROR 1141 (42000): There is no such grant defined for user 'powerdns' on host '%'
mysql> GRANT SELECT on powerdns.* TO [email protected];
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '-mailer.com' at line 1
mysql> GRANT SELECT on powerdns.* TO powerdns@'luke.ex-mailer.com';
Query OK, 0 rows affected (0.00 sec)
mysql> show grants for powerdns;
ERROR 1141 (42000): There is no such grant defined for user 'powerdns' on host '%'
mysql> create user powerdns@'%' identified by 'asdlfkjalsdfjiqaw4m3oalimsdvlakwejr;lkj';
@wwalker
wwalker / the-story
Last active January 3, 2016 23:00
mysql question about duplicates
So, I have a table (simpleified greatly)
CREATE TABLE `participants` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`program_id` int(11) NOT NULL,
`user_key` varchar(64) NOT NULL,
PRIMARY KEY (`id`),
);
I run this:
@wwalker
wwalker / 0-command
Last active December 22, 2015 22:27
Why can't I self renew in vault? Never mind. the feature doesn't exist in 0.3.1, time to upgrade.
curl --tlsv1.2 -v -d @asdf.json -X POST -H "X-Vault-Token: $VAULT_TOKEN" https://127.0.0.1:8200/v1/sys/auth/token/renew-self