Skip to content

Instantly share code, notes, and snippets.

@SFEley
SFEley / secret.rake
Created April 22, 2013 01:18
Open an encrypted data bag item in one's usual editor, decrypted. Adapted from Aaron Jensen's excellent script: https://gist.github.com/aaronjensen/4123044
namespace :secret do
desc "Edit an encrypted data bag item in EDITOR"
task :edit, :item do |t, args|
unless ENV['EDITOR']
puts "No EDITOR found. Try:"
puts "export EDITOR=vim"
exit 1
end
abort 'usage: rake "secret:edit[<item name>]"' unless args.item
@TooTallNate
TooTallNate / install-nodejs.sh
Created August 7, 2012 18:55
Simple Node.js installation script using the precompiled binary tarballs
#!/bin/sh
VERSION=0.8.6
PLATFORM=darwin
ARCH=x64
PREFIX="$HOME/node-v$VERSION-$PLATFORM-$ARCH"
mkdir -p "$PREFIX" && \
curl http://nodejs.org/dist/v$VERSION/node-v$VERSION-$PLATFORM-$ARCH.tar.gz \
| tar xzvf - --strip-components=1 -C "$PREFIX"
@gcatlin
gcatlin / gist:1847248
Created February 16, 2012 19:43
Install specific version of Homebrew formula
brew update
brew versions FORMULA
cd `brew --prefix`
git checkout HASH Library/Formula/FORMULA.rb # use output of "brew versions"
brew install FORMULA
brew switch FORMULA VERSION
git checkout -- Library/Formula/FORMULA.rb # reset formula
## Example: Using Subversion 1.6.17
#
@mitchellh
mitchellh / gist:1277049
Created October 11, 2011 01:30
Configure Vagrant VM to use Host DNS for VPN
Vagrant::Config.run do |config|
# ...
config.vm.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
end
@sebastienblanc
sebastienblanc / twitterSearchDSL.groovy
Created June 2, 2011 19:21
Basic Twitter search DSL
import groovyx.net.http.*
@Grab(group='org.codehaus.groovy.modules.http-builder',
module='http-builder', version='0.5.1' )
def http = new HTTPBuilder( 'http://search.twitter.com/' )
def tweets = 'tweets'
def search = {String s -> [about: {String s2 ->
http.get( path: 'search.json',
query: [q:s2] ) { resp, json ->
json.results.each {
# These are my notes from the PragProg book on CoffeeScript of things that either
# aren't in the main CS language reference or I didn't pick them up there. I wrote
# them down before I forgot, and put it here for others but mainly as a reference for
# myself.
# assign arguments in constructor to properties of the same name:
class Thingie
constructor: (@name, @url) ->
# is the same as:
@berngp
berngp / setup.groovy
Created April 22, 2011 01:33
Missing renderer for Unit Testing within Grails
controller.metaClass.render = {Map map, Closure closure ->
renderArgs.putAll(map)
switch(map.contentType) {
case null:
break
case 'application/xml':
case 'text/xml':
def smb = new StreamingMarkupBuilder()
if (map.encoding){
@acreeger
acreeger / JConsole.groovy
Created April 8, 2011 19:01
A script that allows you launch a grails-app then launch a JConsole instance that connects to it. Useful for using JMX with a grails app. Place this in your 'scripts' folder. Usage: 'grails jconsole'
import java.lang.management.ManagementFactory
includeTargets << grailsScript("_GrailsPackage")
includeTargets << grailsScript("_GrailsRun")
target(main: "Launches an app and automatically launches JConsole") {
//depends(compile, classpath, runApp)
depends(checkVersion, configureProxy, packageApp, parseArguments)
if (argsMap.https) {
runAppHttps()
@marc0der
marc0der / Grails on Ubuntu
Created April 4, 2011 16:07
Install Grails on Ubuntu through LaunchPad
sudo add-apt-repository ppa:groovy-dev/grails
sudo apt-get update
sudo apt-get install grails-ppa
#to add grails 2.0.x
sudo apt-get install grails 2.0.x
#to add grails 1.3.9
sudo apt-get install grails-1.3.9
@mfwarren
mfwarren / .ctags
Created January 24, 2011 16:34
my .ctags syntax file for Groovy language (exuberant-ctags)
--langdef=groovy
--langmap=groovy:.groovy
--regex-groovy=/^[ \t]*[(private|public|protected) ( \t)]*def[ \t]+([A-Za-z0-9_]+)[ \t]*\(/\1/f,function,functions/
--regex-groovy=/^[ \t]*private def[ \t]+([A-Za-z0-9_]+)[ \t]*/\1/v,private,private variables/
--regex-groovy=/^[ \t]*public def[ \t]+([A-Za-z0-9_]+)[ \t]*/\1/u,public,public variables/
--regex-groovy=/^[ \t]*[abstract ( \t)]*[(private|public) ( \t)]*class[ \t]+([A-Za-z0-9_]+)[ \t]*/\1/c,class,classes/
--regex-groovy=/^[ \t]*[abstract ( \t)]*[(private|public) ( \t)]*enum[ \t]+([A-Za-z0-9_]+)[ \t]*/\1/c,class,classes/