Skip to content

Instantly share code, notes, and snippets.

@ryansb
ryansb / sns_to_slack.js
Created August 23, 2015 14:27
Forward SNS messages to Slack Webhook receivers with AWS Lambda
console.log('Loading function');
const https = require('https');
const url = require('url');
// to get the slack hook url, go into slack admin and create a new "Incoming Webhook" integration
const slack_url = 'https://hooks.slack.com/services/<KEY STUFF>';
const slack_req_opts = url.parse(slack_url);
slack_req_opts.method = 'POST';
slack_req_opts.headers = {'Content-Type': 'application/json'};
Verifying that +ryansb is my Bitcoin username. You can send me #bitcoin here: https://onename.io/ryansb
#!/bin/bash
set -e
COOKBOOKS="`ls path/to/cookbooks`"
for BOOK in $COOKBOOKS; do
git subtree split --prefix chef/cookbooks/$BOOK --branch CB_Branch_$BOOK
rm -rf chef/cookbooks/$BOOK
done
#!/bin/bash
# Git subtree is included in git 1.7+, this part is only if you have below v1.7.
#git clone https://github.com/apenwarr/git-subtree.git && cd git-subtree
#sudo yum install xmlto asciidoc
#make doc
#sudo make install
cd ~/code/myrepo
git subtree split --prefix path/you/want --branch WhatIWant
#!/bin/sh
#
# Install NPM in the current virtualenv.
#
# Based on a post by Natim:
# http://stackoverflow.com/questions/8986709/how-to-install-lessc-and-nodejs-in-a-python-virtualenv
set -e
NODEJS="http://nodejs.org/dist/v0.11.6/node-v0.11.6-linux-x64.tar.gz"
package main
import (
"crypto/sha256"
"encoding/hex"
"fmt"
)
func main() {
hash := sha256.New()
caption string "%?%F%{= Bk}%? %C%A %D %d-%m-%Y %{= kB} %t%= %?%F%{= Bk}%:%{= wk}%? %n "
hardstatus alwayslastline
hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %d/%m %{W}%c %{g}]'
@ryansb
ryansb / cjd.instructions
Created April 19, 2013 18:29
Quick instructions for installing CJDNS on RHEL derivatives
yum install gcc gcc-g++ make git
cd /opt
git clone git://github.com/cjdelisle/cjdns.git
cd cjdns
./do
./cjdroute --genconf > /etc/cjdroute.conf
curl https://gist.github.com/ryansb/5422219/raw/4f8c788ce6d608e6e9539238ec8b39b6e13e4de2/cjdns > /etc/init.d/cjdns
@ryansb
ryansb / cjdns
Created April 19, 2013 18:27
A slightly modified init script for CJDNS that puts the config in a sane location.
#!/bin/bash
#
# You may redistribute this program and/or modify it under the terms of
# the GNU General Public License as published by the Free Software Foundation,
# either version 3 of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
import json
from collections import defaultdict
gitinfo = json.loads(raw_input())
files_by_user = defaultdict(set)
users_by_file = defaultdict(set)
for commit in gitinfo:
for f in commit['files']: