Skip to content

Instantly share code, notes, and snippets.

View lukecampbell's full-sized avatar

Luke Campbell lukecampbell

View GitHub Profile
#!/bin/sh
BOOT2DOCKER_CERTS_DIR=/var/lib/boot2docker/certs
CERTS_DIR=/etc/ssl/certs
CAFILE=${CERTS_DIR}/ca-certificates.crt
for cert in $(/bin/ls -1 ${BOOT2DOCKER_CERTS_DIR}); do
SRC_CERT_FILE=${BOOT2DOCKER_CERTS_DIR}/${cert}
CERT_FILE=${CERTS_DIR}/${cert}
HASH_FILE=${CERTS_DIR}/$(/usr/local/bin/openssl x509 -noout -hash -in ${SRC_CERT_FILE} 2>/dev/null)
@lukecampbell
lukecampbell / tmux-cheatsheet.markdown
Created July 28, 2016 18:35 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert $1 -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 $2

Results

# Generated by iptables-save v1.4.7 on Thu Sep 27 14:26:55 2012
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [400786:573921566]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -p udp -m state --state NEW -m udp -s 192.168.1.0/24 --dport 5432 -j ACCEPT
curl -X DELETE "http://localhost:9200/venues"
curl -X POST "http://localhost:9200/venues"
curl -X POST "http://localhost:9200/venues/venue/_mapping" -d '
{
"venue" : {
"properties" : {
"name" : { "type" : "string" },
"pin" : {
"properties" : {
@lukecampbell
lukecampbell / couchdb_ingestion_example.py
Created January 31, 2012 20:33 — forked from swarbhanu/couchdb_ingestion_example.py
A small script to do couchdb operations in coi-services.
from pyon.datastore.couchdb.couchdb_datastore import CouchDB_DataStore
from interface.objects import BlogPost, BlogAuthor, BlogComment
from pyon.core.exception import BadRequest
import time
db = CouchDB_DataStore()
# Creates a datastore
datastore_name = 'dm_datastore'
try: