Skip to content

Instantly share code, notes, and snippets.

@gbarboza
gbarboza / ocaml-setup.sh
Last active May 23, 2017 00:30
OCaml setup with jbuilder
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR=test-jbuilder-project
COMP_VER=4.04.1
if ! type opam &> /dev/null; then
echo "You need to install opam"
exit 1
fi
@gbarboza
gbarboza / cache.py
Last active February 12, 2016 19:36
import time
import random
from boto.s3.bucket import Bucket
from boto.s3.connection import S3Connection
from boto.s3.key import Key
from dogpile.cache import make_region
import logging
logging.basicConfig()

Example: You have a branch refactor that is quite different from master. You can't merge all of the commits, or even every hunk in any single commit or master will break, but you have made a lot of improvements there that you would like to bring over to master.

Note: This will not preserve the original change authors. Only use if necessary, or if you don't mind losing that information, or if you are only merging your own work.

On master:

> git co -b temp

Keybase proof

I hereby claim:

  • I am gbarboza on github.
  • I am gbarboza (https://keybase.io/gbarboza) on keybase.
  • I have a public key whose fingerprint is 3AE2 0376 7AAD D90D 2BF3 242A E82C 5DFB 321B 1B1C

To claim this, I am signing this object:

# SSH1 only
command="log-and-run" ...key...
where log-and-run is the following script. It appends a line to a log file, containing a timestamp and the command attempted:
#!/bin/sh
if [ -n "$SSH_ORIGINAL_COMMAND" ]
then
echo "`/bin/date`: $SSH_ORIGINAL_COMMAND" >> $HOME/ssh-command-log
exec $SSH_ORIGINAL_COMMAND
fi
#!/usr/bin/env python
import os
import SocketServer
import threading
class threadedserver(SocketServer.ThreadingMixIn, SocketServer.TCPServer):
pass
class incoming(SocketServer.BaseRequestHandler):
def handle(self):
@gbarboza
gbarboza / home-setup
Last active December 14, 2015 00:49
home-setup
#!/usr/bin/env bash
### Begin configuration
HOST=$(hostname -s)
SSH_CONFIG=~/.ssh/config
KEY_SIZE=2048
BB_KEY=~/.ssh/keys/bitbucket
GH_KEY=~/.ssh/keys/github