Skip to content

Instantly share code, notes, and snippets.

View jonathanmarvens's full-sized avatar

Jonathan Barronville jonathanmarvens

View GitHub Profile
#!/usr/bin/env python2
# Quick and dirty demonstration of CVE-2014-0160 by Jared Stafford ([email protected])
# The author disclaims copyright to this source code.
import sys
import struct
import socket
import time
import select
#!/usr/bin/python
# Connects to servers vulnerable to CVE-2014-0160 and looks for cookies, specifically user sessions.
# Michael Davis ([email protected])
# Based almost entirely on the quick and dirty demonstration of CVE-2014-0160 by Jared Stafford ([email protected])
# The author disclaims copyright to this source code.
import select

So apparently MRI brings along its own statically linked OpenSSL:

$ openssl version
OpenSSL 0.9.8y 5 Feb 2013

$ ruby -v
ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-darwin12.0]

$ ruby -r openssl -e 'puts OpenSSL::OPENSSL_VERSION'
var fs = require('fs');
var pathJoin = require('path').join;
// Given a repo instance and a fs path, import the path (recursivly) and return
// the final root hash. Supports symlinks and executable files.
module.exports = function (repo, path, callback) {
return importPath(repo, path, function (err, stat) {
if (err) return callback(err);
return callback(null, stat.hash);
});
require 'tire'
require 'nobrainer'
NoBrainer.connect 'rethinkdb://server/company'
class Employee
include NoBrainer::Document
field :name
field :title

THIS JUST IN: @WebandPHP Embrace Women in an attempt to Enhance PHPness and Boost Subscriptions

< sarcasm >

(PHP) -- A massive sexist storm spanning the globe dumped thousands of foreign messages on unsuspecting geeks as they watched as their tweet stream, normally depicting handy references to JS resources, object oriented design structures and REGEX utilities, turned into a thick sludge of sadness and despair, dividing the community.

Observers agreed, the divide also provided a distinct benefit by making easy work of identifying and arresting misogynist asshats who threaten the very fabric of a community, a community known for communicating using curly brackets, semi-colons and now, with PHP 5.3, namespaces.

Those detained now await no trail, but are able to exercise their right to a quick tagging and permanent display on the Geek Feminist Wiki.

The following example uses the '::' operator which has a proposal already and a champion on the committee. Other than the bind operator, the example I give uses no new syntax (other than what is new to ES6), and could fairly easily be polyfilled - though I expect it could be optimized if implemented natively. If you haven't seen Clojure protocols, they allow for single dispatch polymorpism based on type, without the methods being defined as part of that type. In clojure, they use the first parameter, but for my proposal, it uses the receiver (this), and uses the bind operator to make the call look similar to a normal method call. While I haven't actually written an implementation of the Protocol class I demonstrate here, I've thought enough about it that I feel it could be done in a few different ways without too much complexity.

/**
  • The following module is a sampling of underscore methods conver
<?php
// Resizer and Image Manipulation
// Based on: http://forums.laravel.com/viewtopic.php?id=2648
public function post_edit_logo($id)
{
$rules = array(
'image' => 'image',
);

Problem 1

Use JavaScript to write a function that takes a number as its argument. If the number is less than 10, the function should return "small"; if the number is 10 or greater, but less than 100, the function should return "medium"; if the number is 100 or greater, the function should return "large".

Problem 2

Use JavaScript to write a function that takes a number as its argument. If the number is between 1 and 10 (inclusive), return the word for that number (that is, if the number passed to the function is 2, return the word "two"). If the number is not between 1 and 10, return false.