Skip to content

Instantly share code, notes, and snippets.

@pearofducks
pearofducks / ruby_setup.sh
Last active August 29, 2015 14:04
Ruby setup for debian/ubuntu
#!/bin/bash
apt-get update -y
apt-get install -y build-essential
wget -O ruby-install-0.5.0.tar.gz https://github.com/postmodern/ruby-install/archive/v0.5.0.tar.gz
tar -xzvf ruby-install-0.5.0.tar.gz
cd ruby-install-0.5.0/
make install
@pearofducks
pearofducks / gist:db187b132cdf5d568de0
Created August 25, 2014 11:31
Python fix UTF-8 encoding
import sys
reload(sys) # Reload does the trick!
sys.setdefaultencoding('UTF8')
@pearofducks
pearofducks / Dockerfile
Last active August 29, 2015 14:05
kaia alpha
FROM debian:wheezy
# phusion/baseimage:0.9.12
ENV HOME /root
WORKDIR /root
RUN apt-get update && apt-get install -y build-essential libxslt1-dev libxml2-dev zlib1g-dev libpcre3-dev libbz2-dev libssl-dev wget git
RUN wget http://nginx.org/download/nginx-1.6.1.tar.gz && tar xf nginx-1.6.1.tar.gz && git clone https://github.com/yaoweibin/nginx_tcp_proxy_module.git
RUN cd nginx-1.6.1 && patch -p1 < ../nginx_tcp_proxy_module/tcp.patch
RUN cd nginx-1.6.1 && ./configure --add-module=../nginx_tcp_proxy_module --prefix=/nginx && make && make install
RUN apt-get purge -y build-essential wget git && apt-get clean autoclean && apt-get autoremove -y
apt-get install libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev build-essential libevent-dev libtool autoconf automake pkg-config libpcre3-dev zlib1g-dev liblzma-dev
#git
#procps-ng
./configure --prefix=/usr \
--exec-prefix= \
--libdir=/usr/lib \
@pearofducks
pearofducks / gist:bfc75310a53d67b4214e
Created October 25, 2014 21:07
osx printer install
#!/bin/sh
printername="XX - Lexmark"
location="XX - YY Office"
gui_display_name="XX - Lexmark"
address="socket://10.51.0.2"
driver_ppd="/Library/Printers/PPDs/Contents/Resources/Lexmark CX410 Series.gz"
### Printer Install ###
# Install the printer.
/usr/sbin/lpadmin -p "SF.3F.Lexmark" -L "MT-SF Office" -E -v socket://10.51.0.2 -P "$driver_ppd" -o printer-is-shared=false
@pearofducks
pearofducks / gist:0b6cfc10e7c7b00fed57
Created July 14, 2015 14:31
python simplehttpserver with custom header for apple passbook
#!/usr/bin/env python
import SimpleHTTPServer
class MyHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
def end_headers(self):
self.send_my_headers()
SimpleHTTPServer.SimpleHTTPRequestHandler.end_headers(self)
def send_my_headers(self):
remote: error: refusing to update checked out branch: refs/heads/master
remote: error: By default, updating the current branch in a non-bare repository
remote: error: is denied, because it will make the index and work tree inconsistent
remote: error: with what you pushed, and will require 'git reset --hard' to match
remote: error: the work tree to HEAD.
remote: error:
remote: error: You can set 'receive.denyCurrentBranch' configuration variable to
remote: error: 'ignore' or 'warn' in the remote repository to allow pushing into
remote: error: its current branch; however, this is not recommended unless you
remote: error: arranged to update its work tree to match what you pushed in some
@pearofducks
pearofducks / md5hasher.py
Last active October 20, 2015 07:42
python directory hasher - super quick and dirty
#!/usr/bin/env python
import os, hashlib
current_dir = os.getcwd()
hashes = []
for root,dirs,files in os.walk(current_dir):
for f in files:
current_file = os.path.join(root,f)
H = hashlib.md5()
try:
ssh-keygen -t ecdsa -b 521
@pearofducks
pearofducks / rbenv-install.sh
Last active December 16, 2015 18:59
Rbenv local install and ruby 2.0-p0 on deb/ubuntu
#!/bin/bash
sudo apt-get update
sudo apt-get -y upgrade
sudo apt-get -y install build-essential
sudo apt-get -y install git-core
sudo apt-get -y install libssl1.0.0 libssl-dev
git clone git://github.com/sstephenson/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> .bash_profile
echo 'eval "$(rbenv init -)"' >> .bash_profile
source ~/.bash_profile