Skip to content

Instantly share code, notes, and snippets.

A Thor Task to unwatch all Github watched repositories (excluding owned) and optionally export to delicious.

Sorry Github, for I have sinned. I use the Watch feature as a bookmarker.

Install required gems:

gem install thor rest-client

Use it as such:

@thenoseman
thenoseman / jsonval.sh
Created July 5, 2011 12:00 — forked from cjus/jsonval.sh
Extract a JSON value from a BASH script
#!/bin/bash
function jsonval {
temp=`echo $json | sed 's/\\\\\//\//g' | sed 's/[{}]//g' | awk -v k="text" '{n=split($0,a,","); for (i=1; i<=n; i++) print a[i]}' | sed 's/\"\:\"/\|/g' | sed 's/[\,]/ /g' | sed 's/\"//g' | grep -w $prop`
echo ${temp##*|}
}
json=`curl -s -X GET http://twitter.com/users/show/$1.json`
prop='profile_image_url'
picurl=`jsonval`
@thenoseman
thenoseman / gist:1173309
Created August 26, 2011 12:34 — forked from thomasjachmann/gist:1173001
restore lost git commits
#!/usr/bin/env ruby
# Helps recovering lost commits, eg when you've:
# - dropped a stash
# - reset a branch to an earlier commit, dropping the changes with --hard
#
# Shows which files have been changed in which dangling commit and prints
# the commands to view details of and restore a commit.
#
# When given a parameter, only lists commits that changed a file matching
@thenoseman
thenoseman / Gemfile
Created September 16, 2011 18:16 — forked from chriseppstein/readme.md
How to integrate Compass with Rails 3.1 asset pipeline
group :assets do
gem 'sass-rails', '~> 3.1.0'
gem 'coffee-rails', '~> 3.1.0'
gem 'uglifier'
gem 'compass', '~> 0.12.alpha'
# include other compass plugins here. E.g.:
gem 'compass-susy-plugin', :require => 'susy'
end
@thenoseman
thenoseman / 0-readme.md
Created June 12, 2012 07:37 — forked from sj26/0-readme.md
ruby-1.9.3-p194 cumulative performance patch.

Patched ruby 1.9.3-p194 for 30% faster rails boot

What is?

This script installs a patched version of ruby 1.9.3-p194 with patches for boot-time performance improvements (#66 and #68), and runtime performance improvements (#83 and #84). It also includes the new backported GC from ruby-trunk.

Huge thanks to funny-falcon for the performance patches.

@thenoseman
thenoseman / .vimrc
Created September 13, 2012 20:05 — forked from c9s/.vimrc
fun! EvalVimScriptRegion(s,e)
let lines = getline(a:s,a:e)
let file = tempname()
cal writefile(lines,file)
redir @e
silent exec ':source '.file
cal delete(file)
redraw
redir END
echo "Region evaluated."
def write_backtrace name, backtrace, filename
exceptions = Regexp.union([
/\.bundle/,
/spec/,
/test/,
/lib\/ruby\/1.9.1/
])
backtrace.reject! { |line| line =~ exceptions }
#!/bin/bash
#
# Based on: http://imaginationunbound.blogspot.com/2007/12/adobe-photoshop-cs3-on-mac-os-x-case.html
# Instructions for use
# 1. Copy Photoshop CS5 from a case-insensitive install by copying these folders:
# a) "old_disk_image/Library/Application Support/Adobe" to "/Library/Application Support/Adobe
# b) "old_disk_image/Library/Application Support/FLEXnet Publisher" to "/Library/Application Support/FLEXnet Publisher
# c) "old_disk_image/Library/ScriptingAdditions/Adobe Unit Types.osax" to "/Library/ScriptingAdditions/Adobe Unit Types.osax
# d) "old_disk_image/Applications/Adobe Photoshop CS5" to "/Applications/Adobe Photoshop CS5"
# 2. Run the script below to rename all the folders Adobe's programmers where too lazy to name correctly.

How to set up stress-free SSL on an OS X development machine

One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.

Most workflows make the following compromises:

  • Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.

  • Use production SSL certificates locally. This is annoying

@thenoseman
thenoseman / patch-edid.rb
Created October 28, 2015 19:44 — forked from adaugherity/patch-edid.rb
Generate a patched monitor definition file with forced RGB. Might solve display resolution issues for external monitors on macbooks
#!/usr/bin/ruby
# Create display override file to force Mac OS X to use RGB mode for Display
# see http://embdev.net/topic/284710
require 'base64'
data=`ioreg -l -d0 -w 0 -r -c AppleDisplay`
edids=data.scan(/IODisplayEDID.*?<([a-z0-9]+)>/i).flatten
vendorids=data.scan(/DisplayVendorID.*?([0-9]+)/i).flatten