Skip to content

Instantly share code, notes, and snippets.

@richmidwinter
richmidwinter / index.html
Created December 1, 2012 23:24
FCO Travel Advice
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.country {
fill: #b8b8b8;
stroke: #fff;
stroke-width: .5px;
stroke-linejoin: round;
}
@richmidwinter
richmidwinter / pop3.py
Created December 30, 2012 20:07
A fake POP3 server in python which prints authentication details.
#!/usr/bin/env python
import socket
c = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
c.bind(('192.168.1.100',110))
c.listen(1)
while 1:
csock, caddr = c.accept()
cfile = csock.makefile('rw', 0)
@richmidwinter
richmidwinter / bash.sh
Last active May 19, 2022 12:28
Setup bash env.
#!/bin/bash
extract () {
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar e $1 ;;
*.gz) gunzip $1 ;;
@richmidwinter
richmidwinter / CacheTest.java
Created January 26, 2013 12:23
JSR-107 example.
package javax.cache;
import org.junit.Test;
import java.util.concurrent.TimeUnit;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertNull;
/**
{
frames: [
{
src: "https://upload.wikimedia.org/wikipedia/commons/thumb/b/bd/12-07-12-wikimania-wdc-by-RalfR-010.jpg/290px-12-07-12-wikimania-wdc-by-RalfR-010.jpg"
},{
src: "https://maps.googleapis.com/maps/api/staticmap?center=1400+I+Street,Northwest+Washington,D.C.+20005&zoom=13&size=600x300&sensor=false"
},{
src: "https://upload.wikimedia.org/wikipedia/commons/thumb/1/17/McPherson_Square_pylon.jpg/114px-McPherson_Square_pylon.jpg"
}
]
@richmidwinter
richmidwinter / vimrc
Last active December 15, 2015 16:49
Vim runcom
execute pathogen#infect()
syntax on
filetype on
colors solarized
syntax enable
set background=dark
colorscheme solarized
@richmidwinter
richmidwinter / ec2.sh
Last active December 15, 2015 16:49
Setup EC2 for Alfresco dev
#
# Environment setup for developing with Alfresco on EC2
#
# curl -sL http://goo.gl/k0rpz -o ec2.sh && . ec2.sh && rm ec2.sh
#
echo "#export PROMPT_COMMAND=\"\$PROMPT_COMMAND && date\"
alias vi='vim'
" >> ~/.bashrc
GIT_COMPLETION_PATH="/usr/local/etc/bash_completion.d/git-completion.bash"
GIT_PROMPT_PATH="/usr/local/etc/bash_completion.d/git-prompt.sh"
if [ -f "$GIT_COMPLETION_PATH" ]; then
GIT_PS1_SHOWDIRTYSTATE=true
. "$GIT_COMPLETION_PATH"
. "$GIT_PROMPT_PATH"
ADD_PS1='$(__git_ps1)'
fi
if [[ ${EUID} == 0 ]] ; then
#!/usr/bin/env ruby
@file_patterns = File.readlines("#{Dir.home}/.cuignore")
@ptn = ARGV[0]
def search(f)
res = {}
h = File.open(f, 'r')
h.each_line {|line|
if line.index(@ptn)
@richmidwinter
richmidwinter / xxd.go
Last active August 29, 2015 14:13
xxd in golang
package main
import (
"bufio"
"fmt"
"io"
"os"
)
const (