Skip to content

Instantly share code, notes, and snippets.

View dtjm's full-sized avatar

Sam Nguyen dtjm

  • Twilio SendGrid
  • Pacific Northwest
View GitHub Profile
@dtjm
dtjm / writeroom-wrapper-googlecl.sh
Created July 10, 2010 06:55
A command-line wrapper you can use to call WriteRoom from GoogleCL
#!/bin/bash -x
# WriteRoom command-line launcher by Sam Nguyen
# Made to be used with googlecl docs
# Works with svn rev 341 of googlecl
#
# usage:
# google docs edit --title "My title" --editor /path/to/writeroom-wrapper-googlecl.sh
########################################
# * * * * * command to be executed
# - - - - -
# | | | | |
# | | | | +- - - - day of week (0 - 6) (Sunday=0)
# | | | +- - - - - month (1 - 12)
# | | +- - - - - - day of month (1 - 31)
# | +- - - - - - - hour (0 - 23)
# +- - - - - - - - minute (0 - 59)
@dtjm
dtjm / file-dialog-filters.diff
Created July 26, 2010 22:58
A script to install qcachegrind (the QT version of KCacheGrind) from the source tree at the KDE project. It will also install QT from homebrew with the required dependencies (which takes about 2 hours).
Index: qcachegrind/qcgtoplevel.cpp
===================================================================
--- qcachegrind/qcgtoplevel.cpp (revision 1155013)
+++ qcachegrind/qcgtoplevel.cpp (working copy)
@@ -792,7 +792,7 @@
file = QFileDialog::getOpenFileName(this,
tr("Open Callgrind Data"),
_lastFile,
- tr("Callgrind Files (callgrind.*)"));
+ tr("Cachegrind Files (*cachegrind.*);;Callgrind Files (*callgrind.*);;All Files (*)"));
### diff -ur daemontools-0.76.old/src/error.h daemontools-0.76/src/error.h
### via http://www.qmail.org/moni.csi.hu/pub/glibc-2.3.1/daemontools-0.76.errno.patch
### and http://whomwah.com/2008/11/04/installing-daemontools-on-centos5-x86_64/
--- daemontools-0.76.old/src/error.h 2001-07-12 11:49:49.000000000 -0500
+++ daemontools-0.76/src/error.h 2003-01-09 21:52:01.000000000 -0600
@@ -3,7 +3,7 @@
#ifndef ERROR_H
#define ERROR_H
-extern int errno;
@dtjm
dtjm / vsftpd.init
Created August 4, 2010 22:12
A patched init script for vsftpd that will create PID files under /var/run/vsftpd. If you have a configuration file /etc/vsftpd/vsftpd-foo.conf, it will create the PID file /var/run/vsftpd/vsftpd-foo.pid
#!/bin/bash
#
# vsftpd This shell script takes care of starting and stopping
# standalone vsftpd. Customized to be used with CentOS 5.4
# and Monit by creating PID files for each process
#
# chkconfig: - 60 50
# description: Vsftpd is a ftp daemon, which is the program \
# that answers incoming ftp service requests.
# processname: vsftpd
@dtjm
dtjm / install-daemonize.sh
Created August 4, 2010 23:32
A script that will download, compile, and install daemonize. Works on Centos 5.4
#!/bin/bash
DIR=daemonize-src
[ -d $DIR ] || mkdir $DIR
cd $DIR
curl -L http://github.com/bmc/daemonize/tarball/release-1.6 | tar zxv
cd bmc-daemonize-*
./configure
make
sudo make install
@dtjm
dtjm / helpers.php
Created August 6, 2010 16:30
Helper functions for doing terminal output
<?php
function message($text) {
printf('%-48s: ', $text);
}
function succeed($text = ' OK ') {
$esc = chr(27);
echo "[{$esc}[0;33m$text{$esc}[0m$esc" . "\]\n";
}
@dtjm
dtjm / monitrc.vim
Created August 6, 2010 17:38
Vim syntax file for Monit configuration files
" Vim syntax file
" Language: Monit control file
" Maintainer: Sam Nguyen
" Latest Revision: 6 August 2010
if exists("b:current_syntax")
finish
endif
syn keyword monitCommand set check include
@dtjm
dtjm / haml_converter.rb
Created August 10, 2010 16:34
HAML plugin for jekyll
# _plugins/haml_converter.rb
module Jekyll
class HamlConverter < Converter
safe true
def setup
return if @setup
require 'haml'
@setup = true
@dtjm
dtjm / .bash_aliases
Created August 13, 2010 17:10
My bash configs.
alias ll='ls -l'
alias lla='ls -la'
alias llh='ls -lh'