Skip to content

Instantly share code, notes, and snippets.

View hexode's full-sized avatar

Alexander Verkhoglyad hexode

  • Toloka
  • Belgrade
  • 10:20 (UTC +02:00)
View GitHub Profile
@hexode
hexode / gist:7517865
Created November 17, 2013 20:27
Pretty form scanner
[].forEach.call(document.querySelectorAll('form'), function (input) {
var table = [];
console.group('HTMLForm "' + input.name + '": ' + input.action);
console.log('Element: ', input, '\nName: ' +
input.name + '\nMethod: ' + input.method.toUpperCase() +
'\nAction: ' + input.action || 'null');
['input', 'textarea', 'select'].forEach(function (control) {
[].forEach.call(input.querySelectorAll(control), function (node) {
table.push({
@hexode
hexode / enum.py
Created January 16, 2014 20:05
Emulation enum in python
# @see http://stackoverflow.com/a/2182437
class Enum(set):
def __getattr__(self, name):
if name in self:
return name
raise AttributeError
#!/usr/bin/env python
#http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/
import sys, os, time, atexit
from signal import SIGTERM
class Daemon:
"""
A generic daemon class.
#!/bin/bash
# Runs the specified command (provided by the first argument) in all tmux panes
# for every window regardless if applications are running in the terminal or not.
function execute_in_all_panes {
# Notate which window/pane we were originally at
ORIG_WINDOW_INDEX=`tmux display-message -p '#I'`
ORIG_PANE_INDEX=`tmux display-message -p '#P'`
var timestampify = (function() {
'use strict';
var SECOND = 1000;
var MINUTE = 60 * SECOND;
var HOUR = 60 * MINUTE;
var DAY = 24 * HOUR;
var MONTH = 30 * DAY;
var YEAR = 365 * DAY;
#Newbie programmer
def factorial(x):
if x == 0:
return 1
else:
return x * factorial(x - 1)
print factorial(6)
#First year programmer, studied Pascal
#!/usr/bin/env python2
"""
Author: takeshix <takeshix@adversec.com>
PoC code for CVE-2014-0160. Original PoC by Jared Stafford (jspenguin@jspenguin.org).
Supportes all versions of TLS and has STARTTLS support for SMTP,POP3,IMAP,FTP and XMPP.
"""
import sys,struct,socket
from argparse import ArgumentParser
#!/bin/bash -e
#
# Author: Werner Beroux <werner@beroux.com>
# Help?
if [[ $# -eq 0 || $1 == --help || $1 == -h ]]
then
echo "inotifyexec version 1.1.0"
echo "Requires inotify-tools."
echo ""
[user]
name = Ton Nom
email = ton@email.tld
[color]
ui = auto
[alias]
st = status
ci = commit
lg = log --graph --pretty=tformat:'%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%an %ar)%Creset'
[core]
@hexode
hexode / rAF.js
Created April 29, 2014 15:29 — forked from paulirish/rAF.js
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];