Skip to content

Instantly share code, notes, and snippets.

View rypit's full-sized avatar

RJ Pittman rypit

View GitHub Profile
@rypit
rypit / SublimeTextforDrupal.sh
Created June 26, 2012 16:05
Sets up Sublime Text 2 for Drupal Development
#!/bin/bash
# Attempt OS detection to set path
os=`uname`;
phpcs=`which phpcs`;
# ST2 Packages directory
if [ $os = 'Linux' ]
then
st2Dir=~/".config/sublime-text-2/Packages/"
#!/bin/sh
IDLE=$((`/usr/sbin/ioreg -c IOHIDSystem | sed -e '/HIDIdleTime/!{ d' -e 't' -e '}' -e 's/.* = //g' -e 'q'` / 1000000000 ))
FILE="$HOME/Dropbox/daily_photo/`date +%Y%m%d`.png"
if [ $IDLE -lt 61 ]; then
PID=`ps auxww |grep loginwindow | grep -v grep | awk '{print $2}'`
D=`date +%Y%m%d_%H%M%S`
imagesnap $FILE
fi
@rypit
rypit / activity_snapshot.sh
Last active December 11, 2015 17:58 — forked from lucaspiller/activity_snapshot.sh
Modified to export a JSON formatted object per entry.
#!/bin/sh
# computer activity data collection for http://jehiah.cz/one-two/
# Originally by Jehiah Czebotar. This verison by Luca Spiller, then RJ Pittman.
FILE="$HOME/Dropbox/activity_log/`hostname`-`date +%Y%m%d`.log"
function log_activity()
{
local TIME=`date "+%Y-%m-%dT%H:%M:%S%z"`
local IDLE=$((`/usr/sbin/ioreg -c IOHIDSystem | sed -e '/HIDIdleTime/!{ d' -e 't' -e '}' -e 's/.* = //g' -e 'q'` / 1000000000 ))
@rypit
rypit / osx-lion-disable-apps-relaunch-on-login.sh
Last active December 17, 2015 20:49
Prevent previously opened applications from relaunching on login in OSX Lion. This shell script writes the configuration necessary to stop OSX Lion from re-opening applications that were open during log out, and locks the file from being edited automatically by the system.
#!/bin/bash
# Disable Apps from Relaunching on login in OSX Lion...
# RJ Pittman | http://github.com/rypit
FILES=~/Library/Preferences/ByHost/com.apple.loginwindow.*.plist
for f in $FILES
do
echo "Settings file: $f"
echo "Unlocking..."
chflags nouchg $f
@rypit
rypit / dmarkow-raspell.sh
Created September 19, 2013 15:09
Install dmarkow-raspell with boxen and homebrew using bundler
bundle config build.dmarkow-raspell --with-opt-dir=/opt/boxen/homebrew/ && bundle
@rypit
rypit / gist:d9206915e951f397f3bc
Created July 23, 2014 01:51
enhanced-oracle_enhanced
SELECT
REPLACE(
DBMS_METADATA.GET_DDL(OBJECT_TYPE, OBJECT_NAME, OWNER),
( SELECT( '"' || SYS_CONTEXT('userenv', 'session_user') || '".' ) FROM DUAL ),
''
) as DDL
FROM ALL_OBJECTS
WHERE OWNER = SYS_CONTEXT('userenv', 'session_user')
AND object_type IN ('TRIGGER');
@rypit
rypit / oracle_enhanced.sh.erb
Last active August 29, 2015 14:04
happy oci8 compilation
export DYLD_LIBRARY_PATH=`brew --prefix`/lib
export ORACLE_HOME=`brew --prefix`/opt/oracle-instant-client
@rypit
rypit / isotope-history.js
Last active August 29, 2015 14:05
Isotope v1 and history.js
/*
This was part of an old tutorial I made that is no longer online.
Newer versions of Isotope and better popState support may obviate this code, but I was asked to repost it.
*/
$(function(){
var History = window.History;
var $container = $('#container'),
// object that will keep track of options
isotopeOptions = {},
  • Thing to do
  • another thing
  • and yet another
@rypit
rypit / idk.rb
Last active August 29, 2015 14:23
Message dispatcher
class YourSubscriber
subscribe(:queue, :or, :something) do |message|
Dispatcher::Base.dispatch_message(message)
end
end
class Dispatcher::Base
def can_process_message?
raise NotImplmenttedError