Skip to content

Instantly share code, notes, and snippets.

View btedev's full-sized avatar

Barry Ezell btedev

  • St. Petersburg, FL
View GitHub Profile
@interface MainViewController : UIViewController <UITextViewDelegate>
...
- (void)textViewDidChange:(UITextView *)textView {
int chars = [textView.text length];
countLabel.text = [NSString stringWithFormat:@"%i/140",chars];
}
@btedev
btedev / Find and mount usb drive in linux
Created August 6, 2010 16:07
Find and mount usb drive in Ubuntu
#verify drive is seen by system
cat /proc/scsi/scsi
#determine which device it is
dmesg | grep sd
#mount
mount /dev/sdc1 /mnt/usb
#or to be extra safe
@btedev
btedev / Using Truecrypt in Ubuntu
Created August 6, 2010 16:43
Mount Truecrypt on Ubuntu
#create a truecrypt file (follow the setup script)
sudo truecrypt -t -c test.tc
#mount TC volume
sudo mkdir /mnt/tc
sudo truecrypt test.tc /mnt/tc
#dismount
sudo truecrypt --dismount /mnt/tc
Resque.after_fork do |job|
# How many jobs should we process in each fork?
jobs_per_fork = [ ENV['JOBS_PER_FORK'].to_i, 1 ].max
# Set hook to nil to prevent running this hook over
# and over while processing more jobs in this fork.
Resque.after_fork = nil
# Make sure we process jobs in the right order.
job.worker.process(job)
@btedev
btedev / sed.sh
Created August 20, 2010 20:57
Copy n lines using sed
#start,end (note: not zero indexed)
sed -n "1,100p" org_file > new_file
@btedev
btedev / pyspread_install.txt
Created November 9, 2010 21:23
Installation instructions for Pyspread on Snow Leopard
I'm a Python newb so YMMV. Python 2.6 64-bit is installed by default and wxPython doesn't play nicely with it, so install 2.7 and the unstable version of wxPython.
1. Install Python 2.7: http://www.python.org/ftp/python/2.7/python-2.7-macosx10.5.dmg
2. Install development wxPython binary "wxPython2.9-osx-cocoa-py2.7" from http://www.wxpython.org/download.php#unstable
3. Install numpy: http://www.scipy.org/Installing_SciPy/Mac_OS_X
4. Download pyspread and edit the following:
@btedev
btedev / timer.rb
Created January 5, 2011 16:19
command-line timer for OS X
#!/usr/bin/env ruby
require 'optparse'
require 'time'
require 'real_growl'
require 'progressbar'
INCREMENTS=100
class TimeFile
@btedev
btedev / SHK.m
Created October 12, 2011 13:10
Mod of ShareKit's SHK.m for iOS 5
//
// SHK.m
// ShareKit
//
// Created by Nathan Weiner on 6/10/10.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
@btedev
btedev / gist:1512036
Created December 22, 2011 21:59
Remove "It seems your ruby installation is missing psych" warning on Ubuntu for Ruby 1.9.3
sudo apt-get install libyaml-dev
gem instal psych
@btedev
btedev / jongify.rb
Created December 30, 2011 04:01
Make a custom Kim Jong Il funeral procession image
# Create your very own Kim Jong Il funeral magic!
# Requires ImageMagick.
# OS X: brew install imagemagick
# Ubuntu: sudo apt-get install imagemagick
#
# Background image from Dustin Fenstermacher via http://gawker.com/5871682/give-yourself-a-dictators-funeral-with-this-kim-jong+il-photoshop-template
abort 'usage: jongify.rb image_file' unless ARGV.size == 1
original_image = ARGV[0]