Skip to content

Instantly share code, notes, and snippets.

View boffbowsh's full-sized avatar

Paul Bowsher boffbowsh

View GitHub Profile
KEY_COLUMN = 2
with csv.reader(f1) as csv1:
d1 = {r[KEY_COLUMN]: r for r in csv1}
with csv.reader(f2) as csv2:
d2 = {r[KEY_COLUMN]: r for r in csv2}
merged_dict = {x:d1[x] for x in d1 if x in d2}
@boffbowsh
boffbowsh / edit.hbs
Created December 30, 2014 00:48
Set a form to use the shadowModel of the controller, and changes won't be saved back to the model (and your list-of-models next to the form) until you call `save()`. Will probably break with relationships, that'll need fixing.
{{#em-form model=shadowModel}}
{{em-input property="name" label="Name"}}
{{em-input property="slug" label="Slug"}}
{{/em-form}}
#!/bin/bash
# apt-get install jq
#set -eu
shopt -s nullglob
readonly base_dir=$1
if [ -z "$base_dir" ] ; then
echo 'please location docker registry store location!';
exit;
fi
#!/usr/bin/perl
use strict;
use LWP::Simple;
use JSON;
use IO::Socket;
use Env qw(RABBITMQ_LOCAL RABBITMQ_OTHER RABBITMQ_USER RABBITMQ_PASS RABBITMQ_NODE_NAME);
sub print_headers {
my $st = shift;
Vagrant.configure("2") do |config|
config.vm.define "centos1" do |config|
config.vm.box = "centos-5.6"
config.vm.box_url = "http://dl.dropbox.com/u/9227672/centos-5.6-x86_64-netinstall-4.1.6.box"
config.vm.provision "shell", path: "centos.sh"
config.vm.network :private_network, ip: "192.168.56.201"
config.vm.hostname = "rabbit1"
end
config.vm.define "centos2" do |config|
#!/bin/bash
test -f ~/.pomodoro || exit
FIGLET="/usr/local/bin/figlet -Wf banner3"
diff=$(($(stat -f%m ~/.pomodoro) + (25*60) - $(date +"%s")))
if [[ $diff -lt 0 && $diff -gt -15 ]]; then
echo "0:00" | $FIGLET
elif [[ $diff -gt 0 ]]; then
#!/usr/bin/env node
var amqp = require("amqp");
// Config
var fromHost = { host: 'message1', login: 'guest', password: 'guest' };
var toHost = { host: 'message3', login: 'guest', password: 'guest' };
var queueName = "queuename";
var queueOpts = {durable: true, passive: true, noDeclare: true};
pbowsher ~ $ rbenv version
1.9.3-p327 (set by RBENV_VERSION environment variable)
pbowsher ~ $ mysql_config
Usage: /usr/local/bin/mysql_config [OPTIONS]
Options:
--cflags [-I/usr/local/Cellar/mysql/5.6.12/include -Wno-null-conversion -Os -g -fno-strict-aliasing]
--cxxflags [-I/usr/local/Cellar/mysql/5.6.12/include -Wno-null-conversion -Os -g -fno-strict-aliasing]
--include [-I/usr/local/Cellar/mysql/5.6.12/include]
--libs [-L/usr/local/Cellar/mysql/5.6.12/lib -lmysqlclient]
--libs_r [-L/usr/local/Cellar/mysql/5.6.12/lib -lmysqlclient_r]
/usr/lib64/erlang/erts-5.10.1/bin/beam.smp -W w -K true -A30 -P 1048576 \
-- -root /usr/lib64/erlang -progname erl -- -home /var/lib/rabbitmq -- \
-pa /usr/lib/rabbitmq/lib/rabbitmq_server-3.1.0/sbin/../ebin -noshell \
-noinput -s rabbit boot -sname rabbit@383990-data13 -boot start_sasl \
-config /etc/rabbitmq/rabbitmq -kernel inet_default_connect_options \
[{nodelay,true}] -sasl errlog_type error -sasl sasl_error_logger false \
-rabbit error_logger {file,"/var/log/rabbitmq/rabbit@383990-data13.log"} \
-rabbit sasl_error_logger {file,"/var/log/rabbitmq/rabbit@383990-data13-sasl.log"} \
-rabbit enabled_plugins_file "/etc/rabbitmq/enabled_plugins" -rabbit plugins_dir \
"/usr/lib/rabbitmq/lib/rabbitmq_server-3.1.0/sbin/../plugins" -rabbit plugins_expand_dir \
#!/usr/bin/env node
var amqp = require("amqp");
var hostOpts = { host: 'local.vm', login: 'xxx', password: 'xxx' };
var queueName = "email.normal.send";
var connection = amqp.createConnection(hostOpts);
connection.on("ready", function() {
// publish to the default exchange which routes to