Skip to content

Instantly share code, notes, and snippets.

View evert0n's full-sized avatar
:octocat:

Everton Yoshitani evert0n

:octocat:
View GitHub Profile
@evert0n
evert0n / anchorinclude.js
Created September 21, 2011 13:16 — forked from scottjehl/anchorinclude.js
Anchor-include Pattern
/*
* anchor-include pattern for already-functional links that work as a client-side include
* Copyright 2011, Scott Jehl, scottjehl.com
* Dual licensed under the MIT
* Idea from Scott Gonzalez
* to use, place attributes on an already-functional anchor pointing to content
* that should either replace, or insert before or after that anchor
* after the page has loaded
* Replace: <a href="..." data-replace="articles/latest/fragment">Latest Articles</a>
* Before: <a href="..." data-before="articles/latest/fragment">Latest Articles</a>
@evert0n
evert0n / supervisord
Created November 8, 2012 09:22
supervisord init script
#! /bin/bash -e
SUPERVISORD=/usr/local/bin/supervisord
PIDFILE=/var/run/supervisord.pid
OPTS="-c /etc/supervisord/supervisord.conf"
test -x $SUPERVISORD || exit 0
. /lib/lsb/init-functions
@evert0n
evert0n / gist:4037818
Created November 8, 2012 09:42 — forked from keimlink/gist:831633
Startup script for the Supervisor server (RHEL)
#!/bin/bash
#
# Startup script for the Supervisor server
#
# Tested with Red Hat Enterprise Linux Server release 5.5
#
# chkconfig: 2345 85 15
# description: Supervisor is a client/server system that allows its users to \
# monitor and control a number of processes on UNIX-like \
# operating systems.
<?php
/*
The problem.
Input is a string—a paragraph of text. One of the paragraphs above would be fine.
Output is a report listing how many words there are with X letters, like:
10 words with 1 letter
20 words with 2 letters
@evert0n
evert0n / project
Created November 14, 2012 12:39 — forked from morphizer/project
Init script for RHEL to start a node.js application, using spark
#!/bin/bash
#
# servicename Starts and stops a service
#
# chkconfig: 345 90 30
# description: Example init script for older node.js application using spark
#
# processname: servicename
### BEGIN INIT INFO
@evert0n
evert0n / example2.js
Created November 15, 2012 10:24 — forked from anonymous/example2.js
MongoDB map reduce example 2
// suggested shell cmd line to run this:
//
// mongo --shell example2.js
//
// Note: the { out : … } parameter is for mongodb 1.8+
db.things.insert( { _id : 1, tags : ['dog', 'cat'] } );
db.things.insert( { _id : 2, tags : ['cat'] } );
db.things.insert( { _id : 3, tags : ['mouse', 'cat', 'dog'] } );
db.things.insert( { _id : 4, tags : [] } );
@evert0n
evert0n / authRoute.js
Created November 16, 2012 18:02 — forked from xcambar/LICENSE
Authenticated routing using AngularJS
authRouteProvider.$inject = ['$routeProvider'];
function authRouteProvider ($routeProvider) {
/**
* Creates a controller bound to the route, or wraps the controller in param
* so the authentication check is run before the original controller is executed
* @param currentController
* @return {Function} The wrapper controller
*/
function redirectCtrlFactory (currentController) {
_ctrl.$inject = ['currentUser__', 'userRole__', '$location'];
@evert0n
evert0n / gist:4209945
Created December 4, 2012 22:57
MySQL Local/Remote FAST Account Password Cracking
#
# http://lists.grok.org.uk/pipermail/full-disclosure/2012-December/089076.html
#
use Net::MySQL;
$|=1;
my $mysql = Net::MySQL->new(
hostname => '192.168.2.3',
@evert0n
evert0n / our_setup_script.js
Created December 10, 2012 00:32 — forked from shussekaido/our_setup_script.js
MongoDB M102 week6 file
db = db.getSisterDB("config");
var mongosConn = db; // assume we connected to a mongos to get going
var res = null;
function check() {
printjson(res);
if( !res || !res.ok ) {
throw "check(): not ok, stopping";
@evert0n
evert0n / gfm.rb
Created February 11, 2013 17:46 — forked from mojombo/gfm.rb
require 'digest/md5'
def gfm(text)
# Extract pre blocks
extractions = {}
text.gsub!(%r{<pre>.*?</pre>}m) do |match|
md5 = Digest::MD5.hexdigest(match)
extractions[md5] = match
"{gfm-extraction-#{md5}}"
end