Skip to content

Instantly share code, notes, and snippets.

View polds's full-sized avatar

Peter Olds polds

View GitHub Profile
@polds
polds / mgo_example.go
Created November 11, 2013 10:25
Mgo Example
package main
import (
"fmt"
"labix.org/v2/mgo"
"labix.org/v2/mgo/bson"
"time"
)
type Person struct {
@polds
polds / httpd.txt
Created November 12, 2013 16:28
Apache configuration to block access to .git folders.
#
# Add this somewhere in your httpd.conf file.
# I recommend you put it near the same
# place that your .htaccess access
# exclusions are configured.
#
<Directorymatch "^/.*/\.git/">
Order deny,allow
Deny from all
</Directorymatch>
@polds
polds / css.sh
Created November 18, 2013 23:49
Minify
for i in $( find "public/" -name "*.css" ! -name "*.min.css" );
do
printf "Minifying %s... " $i
java -jar "./yuicompressor-2.4.8.jar" --type css -o '.css$:.css' "$i"
echo "Done!"
done
@polds
polds / top
Created December 21, 2013 02:15
Top for single user
nice top -d 2 -u nobody -c
package config
type Conf struct {
User, Password String
}
@polds
polds / notify.sh
Last active August 29, 2015 13:55 — forked from jehiah/notify.sh
#!/bin/bash
#
# *************************************************
# chkconfig: 2345 99 99
# description: send pushover notification on system boot.
# *************************************************
# Installing:
# 1) save as /etc/rc.d/init.d/notify
# 2) set the token and user in TOKEN and USER
# 3) chmod a+w /etc/rc.d/init.d/notify
#!/bin/bash
#
# *************************************************
# chkconfig: 2345 99 99
# description: auto-start our deploy script on reboot
# *************************************************
#
# Installation:
# 1. save as /etc/rc.d/init.d/deploy
# 2. chmod a+x /etc/rc.d/init.d/deploy
@polds
polds / server.sh
Created February 7, 2014 00:37
Automatically set our hostname on server startup based on the tag in Amazon.
#!/bin/bash
#
# *************************************************
# chkconfig: 2345 70 99
# description: tasks to perform on server startup
# *************************************************
#
# Installation:
# 1. save as /etc/rc.d/init.d/server
# 2. chmod a+x /etc/rc.d/init.d/server
@polds
polds / README.md
Created April 28, 2014 17:20
Golang Papertrail

Usage

go build log.go
./log --port="1337" 
./log --port="-1" # Prefer local logger
@polds
polds / moshalias.pl
Last active August 29, 2015 14:04 — forked from lexande/moshalias.pl
#!/usr/bin/perl
my $ssh="/usr/bin/ssh";
my $mosh="/usr/bin/mosh";
my $host;
my $unsupported=0;
for (my $i=0; $i <= $#ARGV; $i++) {
if ($ARGV[$i] =~ /^-/) {
$ssh .= " \"$ARGV[$i]\"";