Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python2
# Quick and dirty demonstration of CVE-2014-0160 by Jared Stafford (jspenguin@jspenguin.org)
# The author disclaims copyright to this source code.
import sys
import struct
import socket
import time
import select
@rhettc
rhettc / .pryrc
Last active August 29, 2015 13:56
def app_path
unless @app_path
git_root = `git rev-parse --show-toplevel`.chomp
@app_path = $?.success? ? git_root : Dir.pwd
end
@app_path
end
class Exception
@rhettc
rhettc / with-block.hbs
Created December 18, 2013 17:40
Yay - with blocks
When you're dealing with nested properties, a with block can define a context so that you don't have to write out the full dotted path.
The example below shows that inside the block we can directly access the properties of the book like title without typing book.title.
This is one of my favorite bits of syntactic sugar from VB.NET, glad to see it here.
{{#with book}}
<div class=”book”>
<h1>{{title}}</h1>
{{author}}<br />
{{text}}</p>
</div>
@rhettc
rhettc / ember-sample.js
Last active December 30, 2015 23:39
A look at controllers and templates
// Establishing routes
<script type="text/javascript">
Notes.Router.map(function () {
this.resource('notes', {path: "/"}, function() {
this.route('note', {path: "/note/:note_id"});
});
});
Notes.NotesRoute = Ember.Route.extend({
// Note here where we are "setting the subject for the index action"
@rhettc
rhettc / gitconfig
Created June 5, 2013 20:12
git color config
[color]
ui = true
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red bold
MAKEDEV.i686 3.24-6.6.amzn1 installed
PyYAML.i686 3.09-5.5.amzn1 installed
acl.i686 2.2.49-4.8.amzn1 installed
acpid.i686 1.0.10-2.1.6.amzn1 installed
alsa-lib.i686 1.0.21-3.8.amzn1 installed
apr.i686 1.3.9-3.8.amzn1 @amzn-main
apr-devel.i686 1.3.9-3.8.amzn1 @amzn-main
apr-util.i686 1.3.9-3.9.amzn1 @amzn-main
apr-util-ldap.i686 1.3.9-3.9.amzn1