Skip to content

Instantly share code, notes, and snippets.

@dbehnke
dbehnke / trusty-post-install.sh
Created March 5, 2014 17:54
Ubuntu 14.04 LTS (Trusty) Post Install Tasks
#!/bin/bash
#Post Install for Ubuntu 14.04 LTS (Trusty)
#copy and paste and run - don't run this script directly
#you are going to need to reboot after each part.
echo "Don't run this script directly, copy and paste"
echo "the parts you will use! See the file's comments for information."
echo ""
echo "The script will run part 1 for you.. then read the file for rest!"
@dbehnke
dbehnke / json_generate_demo.ipynb
Created June 4, 2015 16:47
create json using python
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dbehnke
dbehnke / wallpaper-change-gnome3.py
Last active August 29, 2015 14:06
wallpaper changer for Gnome3 (tested on gnome 3.12)
import os
import random
import time
import subprocess
random.seed()
full_files = []
rootdir = "/home/dbehnke/wallpapers"
sleeptime = 300
while 1:
print("reading pictures from ", rootdir)
@dbehnke
dbehnke / envoracle.sh
Created August 27, 2014 15:48
Setup cx_Oracle with Instantclient 12.1 - download the instantclient and sdk from http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html - extract and then place these scripts in the directory - run install-cx_Oracle.sh - you will need to source envoracle.sh to use cx_Oracle or source from your .bashrc
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
export ORACLE_HOME=${DIR}
export LD_LIBRARY_PATH=${DIR}:$LD_LIBRARY_PATH
@dbehnke
dbehnke / ubuntu1404-customize.sh
Created August 10, 2014 01:14
Ubuntu 14.04 Customization Script
#!/bin/bash
function addppa {
add-apt-repository $1 -y
}
function aptinstall {
apt-get install $1 -y
}
@dbehnke
dbehnke / docker-ol7-mkimage.sh
Created July 25, 2014 01:53
Docker build script for Oracle Linux 7 using public-yum
#!/usr/bin/env bash
#
# Create a base CentOS Docker image.
#
# This script is useful on systems with yum installed (e.g., building
# a CentOS image on CentOS). See contrib/mkimage-rinse.sh for a way
# to build CentOS images on other systems.
usage() {
cat <<EOOPTS
@dbehnke
dbehnke / Logging.go
Last active August 29, 2015 14:03
Simple wrapper to Go's built-in logging to add a name field and support DEBUG, INFO, WARN, ERROR levels
package logging
import (
"fmt"
"log"
)
const (
DEBUG = 0
INFO = 1
@dbehnke
dbehnke / lottery.go
Last active August 29, 2015 14:03
A Lottery Simulator (learning exercise) in Go - pick 10 numbers for winning ticket, pick 10000 tickets each round.
package main
import (
"fmt"
"math/rand"
"time"
)
func pickone(ticketsize int) []int {
one := make([]int, ticketsize)
@dbehnke
dbehnke / chanmutex.go
Created June 23, 2014 21:10
Multiple go routines handling a single channel.
package main
//http://play.golang.org/p/kLmBrJYchH
import (
"fmt"
"time"
)
func mychan(id string, c chan string) {
@dbehnke
dbehnke / gorilla-go-json-rpc-test.go
Created April 11, 2014 02:09
JSON RPC with Go and Gorilla
package main
/*test with curl
curl -X POST -H "Content-Type: application/json" \
-d '{"method":"HelloService.Say","params":[{"Who":"Test"}], "id":"1"}' \
http://localhost:10000/rpc
*/
import (
"github.com/gorilla/rpc"