Skip to content

Instantly share code, notes, and snippets.

View gist:2961246
[Wed, 20 Jun 2012 18:20:22 +0200] DEBUG: ---- End uname -o STDERR ----
[Wed, 20 Jun 2012 18:20:22 +0200] DEBUG: Ran (uname -o) returned 0
[Wed, 20 Jun 2012 18:20:22 +0200] DEBUG: Loading plugin linux::filesystem
[Wed, 20 Jun 2012 18:20:22 +0200] DEBUG: Loading plugin linux::uptime
[Wed, 20 Jun 2012 18:20:22 +0200] DEBUG: Loading plugin linux::ssh_host_key
[Wed, 20 Jun 2012 18:20:22 +0200] DEBUG: Loading plugin linux::ps
[Wed, 20 Jun 2012 18:20:22 +0200] INFO: Client key /etc/chef/client.pem is not present - registering
[Wed, 20 Jun 2012 18:20:22 +0200] DEBUG: Signing the request as pinedesk-validator
[Wed, 20 Jun 2012 18:20:22 +0200] DEBUG: String to sign: 'Method:POST
Hashed Path:T5H8a5T8H5qw5E+eZlaLUya7avQ=
@dsummersl
dsummersl / gist:3744192
Created Sep 18, 2012
Example log4j logstash configuration
View gist:3744192
# one way w/o web interface:
# java -jar lib/playbooks/servers/files/logstash-1.1.1-monolithic.jar agent -f lib/playbooks/servers/files/logstash.conf
# another with a web interface(http://localhost:9292) :
# java -jar lib/playbooks/servers/files/logstash-1.1.1-monolithic.jar agent -f lib/playbooks/servers/files/logstash.conf -- web --backend 'elasticsearch:///?local'
# nc localhost 3333 < logfile
#
# When you are all done, you can delete the 'data' folder to delete the database.
input {
tcp {
@dsummersl
dsummersl / gist:4041911
Created Nov 8, 2012 — forked from miceno/gist:802781
Groovy (java) escape HTML with grapes
View gist:4041911
import org.apache.commons.lang.StringEscapeUtils
// Import with groovy grapes:
@Grab(group='commons-lang', module='commons-lang', version='2.3' )
xml = '''
<module id="id" version="0.0.1" package="package"> </module>
'''
StringEscapeUtils.escapeHtml(xml).split("\n").each() {println it }
View .vimrc
" pathogen setup {{{
" Needed on some linux distros.
" see http://www.adamlowe.me/2009/12/vim-destroys-all-other-rails-editors.html
filetype off
call pathogen#runtime_append_all_bundles()
call pathogen#helptags()
filetype on
filetype indent on " Enable filetype-specific indenting
filetype plugin on " Enable filetype-specific plugins
@dsummersl
dsummersl / makeFullScreen.applescript
Created Nov 30, 2012
Applescript script for toggling applications in and out of fullscreen mode.
View makeFullScreen.applescript
on run argv
(*
Toggle an application from full screen to non full screen (or the reverse).
Parameters:
1: application name(ie, Chrome)
2: boolean (true/false).
When true ensure that the application is in full screen mode (if not, make it so)
When false ensure that the application is NOT in full screen mode (if not, make it so)
*)
set theapp to item 1 of argv
@dsummersl
dsummersl / .profile fragment
Created Dec 5, 2012 — forked from christilden/.profile fragment
Lightning-fast project-wide find/replace with git grep and sed
View .profile fragment
gg_replace() {
if [[ "$#" == "0" ]]; then
echo 'Usage:'
echo ' gg_replace term replacement file_mask'
echo
echo 'Example:'
echo ' gg_replace cappuchino cappuccino *.html'
echo
else
find=$1; shift
@dsummersl
dsummersl / .profile fragment
Created Dec 5, 2012 — forked from jcamenisch/.profile fragment
Lightning-fast project-wide find/replace with git grep and sed
View .profile fragment
gg_replace() {
if [[ "$#" == "0" ]]; then
echo 'Usage:'
echo ' gg_replace term replacement file_mask'
echo
echo 'Example:'
echo ' gg_replace cappuchino cappuccino *.html'
echo
else
find=$1; shift
@dsummersl
dsummersl / .profile fragment
Created Dec 5, 2012 — forked from jcamenisch/.profile fragment
Lightning-fast project-wide find/replace with git grep and sed -- with confirm option.
View .profile fragment
gg_replace() {
if [[ "$#" == "0" ]]; then
echo 'Usage:'
echo ' gg_replace term replacement file_mask'
echo ' gg_replace [-c] term replacement file_mask'
echo
echo 'Options:'
echo ' -c == confirm. Allows you to interactively confirm each modification.'
echo
echo 'Example:'
View gist:4570511
let fn = { 'cmpstr': a:1 }
function fn.compare(x,y) dict
let a = a:x
let b = a:y
exec "return ". self.cmpstr
endfunction
return sort(a:list,fn.compare,fn)
View gist:4570550
let list = ['1','10','2']
let fn = { }
function fn.compare(a,b) dict
return str2nr(a:a) < str2nr(a:b)
endfunction
return sort(a:list,fn.compare,fn)