Skip to content

Instantly share code, notes, and snippets.

@dbehnke
dbehnke / getnodejs.sh
Created April 4, 2017 18:05
Get the latest nodejs/npm binaries and extract and create activate script (Linux 64bit)
#!/bin/bash
getversion() {
curl https://nodejs.org/en/ -o index.html
export version=$(cat index.html | grep Current | tail -n 1 | awk -F' v' '{ print $2 }' | awk -F' Current' '{ print $1 }')
}
cleandownload() {
rm index.html
rm node.tar.xz
@dbehnke
dbehnke / Dockerfile
Last active November 10, 2016 16:32
Go Compiling from Centos6 - useful for if you have cgo and need to compile things from oldest Linux possible
FROM centos:6
RUN yum -y update && \
yum -y install curl gcc gcc-c++ libaio-devel git && \
yum clean all && \
rm -r -f /var/cache/yum/*
COPY getgo.sh /opt/
RUN cd /opt && chmod +x ./getgo.sh && ./getgo.sh && mkdir /usr/local/go
RUN groupadd -g 1000 somebody && useradd -m -u 1000 -g 1000 somebody && chown -R somebody:somebody /usr/local/go
ENV GOROOT=/opt/go
ENV GOPATH=/usr/local/go
@dbehnke
dbehnke / generate.sh
Created May 10, 2016 17:37
Using git tags to generate version strings
go build -ldflags "-X main.Version=`git describe --tags --long`" test.go
./test
# 4.16.5-DEV-0-g9a95002
@dbehnke
dbehnke / json_generate_demo.ipynb
Created June 4, 2015 16:47
create json using python
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dbehnke
dbehnke / client.py
Created May 31, 2015 03:29
Python 3.5 async await and asyncio
"""
client.py - AsyncIO Server using StreamReader and StreamWriter
This will create 200 client connections to a server running server.py
It will handshake and run similar to this:
Server: HELLO
Client: WORLD
@dbehnke
dbehnke / luksloopback.sh
Created December 30, 2014 20:25
luks encryption with loopback file
#!/bin/bash
loopdevice=/dev/loop0
loopfile=crypt.loop
#megabytes
loopsize=256
#/dev/mapper/xxxxx when open
cryptmapper=myCrypt
@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