Skip to content

Instantly share code, notes, and snippets.

@nmcv
nmcv / generate_a-z.py
Created November 1, 2012 01:18
Generate lowercase letters of the English alphabet in Python without using strings module
# Lowercase 'a' to 'z' list
print [chr(i) for i in xrange(ord('a'), ord('z')+1)]
@nmcv
nmcv / timing_decorators.py
Created November 6, 2012 02:30
Measure code execution time with Python
'''
A quick way of timing code runs in Python using decorators
'''
import time
def timeit(method):
@nmcv
nmcv / JavaCandR.sublime-build
Created November 10, 2012 21:52 — forked from DevinClark/JavaCandR.sublime-build
This is a build script for Sublime Text 2 that will compile and run the open java file by simply pressing cmd + B. I am very new at Java so feel free to point out problems with this script. You can just drop this file in the User Packges folder and restar
{
"cmd": ["javac", "$file_name"],
"cmd": ["java", "$file_base_name"],
"working_dir": "${project_path:${folder}}",
"selector": "source.java"
}
@nmcv
nmcv / index.html
Created December 2, 2012 16:10
QUnit test suite boilerplate
<!DOCTYPE html>
<html>
<head>
<title>QUnit Test Suite</title>
<link rel="stylesheet" href="//code.jquery.com/qunit/qunit-git.css">
<script src="//code.jquery.com/qunit/qunit-git.js"></script>
<!-- Your project file goes here -->
<script src="myProject.js"></script>
<!-- Your tests file goes here -->
<script src="myTests.js"></script>
@nmcv
nmcv / console.log.sublime-snippet
Created December 13, 2012 15:55 — forked from anonymous/console.log.sublime-snippet
Sublime Text 2 snippet to add console.log() quickly to your JavaScript/jQuery source code.
<snippet>
<content><![CDATA[
/* @DEBUG_START */
//console.log("$SELECTION$1");
/* @DEBUG_END */
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>@log</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.js</scope>
$font-size-base: 16px;
$font-size-minor: 10px;
@mixin font-size($scale: 1) {
font-size: round(
($font-size-base * ((exp(1.618, $scale) - exp(-0.618, $scale)) / 2.236)) +
($font-size-minor * ((exp(1.618, ($scale - 1)) - exp(-0.618, ($scale - 1))) / 2.236))
);
}
.gist-highlight {
border-left: 3ex solid #eee;
position: relative;
}
.gist-highlight pre {
counter-reset: linenumbers;
}
.gist-highlight pre div:before {
@nmcv
nmcv / bash_xor.txt
Created February 1, 2013 11:02
Quick XOR of hexadecimal strings for BASH
# BASH function to get the result
# of a ^ b when a, b are in the
# following hexadecimal string
# form: AF396463D8705 ...
# Obtained from here:
# http://www.codeproject.com/Tips/470308/XOR-Hex-Strings-in-Linux-Shell-Script
# Author is Sanjay1982 (see http://www.codeproject.com/Members/Sanjay1982)
# Usage:
@nmcv
nmcv / xss_ajax_routines.js
Created February 5, 2013 09:48
AJAX routines stub - a bunch of JS which helps do something via AJAX (like posting a form, fetching URL into a buffer, etc.) while XSS'ing your target. No need to tote full jQuery or sort of if you need just the basic AJAX routines.
<script>
function $(e) {
if(typeof e == 'string') e = document.getElementById(e);
return e
};
function collect(a, f) {
var n = [];
for(var i = 0; i < a.length; i++) {
var v = f(a[i]);
# Unofficial brew formula for proxychains 4
# Instruction:
# $ git clone git://gist.github.com/3792521.git gist-3792521
# $ brew install --HEAD gist-3792521/proxychains4_formula.rb
#
# The default config file will be located in /usr/local/etc/proxychains.conf
#
require 'formula'
class Proxychains < Formula