Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/ruby -wKU
class SimpleCipher
attr_accessor :P, :S, :IP
CYCLE_NUM = 4
BLOCK_SIZE = 32
SUB_BLOCK_SIZE = 4
SUB_BLOCK_NUM = BLOCK_SIZE/SUB_BLOCK_SIZE
@mad
mad / gist:1260378
Created October 3, 2011 22:03
quake 3 config (osp)
// generated by quake, do not modify
unbindall
bind TAB "+scores"
bind ENTER "+button2"
bind ESCAPE "togglemenu"
bind SPACE "+moveup"
bind + "sizeup"
bind - "sizedown"
bind 0 "weapon 10"
bind 1 "weapon 1"
var fs = require('fs');
var path = require('path');
var cdr_files = process.argv[2];
var bs_station_file = process.argv[3];
if (cdr_files === undefined || bs_station_file === undefined) {
console.log("input file expected or bs station file expected");
exit;
}
// ==UserScript==
// @name Hide banner in wikipedia
// @namespace wikipedia.org/
// @include http://*.wikipedia.org/*
// @match http://*.wikipedia.org/*
// ==/UserScript==
if (typeof hideBanner == "function") {
console.log("hiding banner");
hideBanner();
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="js-libs/jquery-1.7.js"></script>
<script type="text/javascript" src="js-libs/jquery.tmpl.min.js"></script>
<script type="text/javascript" src="js-libs/underscore.js"></script>
</head>
@mad
mad / gist:1597159
Created January 11, 2012 22:28
mts (avchd) to flv
/usr/bin/ffmpeg -i "~/Videos/00002.MTS" -vcodec flv -f flv -r 25 -s 800x450 -aspect 16:9 \
-b 2000k -g 160 -cmp 2 -subcmp 2 -mbd 2 -flags +aic+cbp+mv0+mv4 \
-trellis 2 -acodec libmp3lame -ac 2 -ar 44100 -ab 256k \
"~/Videos/00002.flv"
@mad
mad / nsd.sh
Created January 17, 2012 16:27
Monitor router open connections in command-line (D-Link DI-604)
#! /bin/bash
LOGIN="admin"
PWD="password"
# now only for d-link DI-604
URL="http://192.168.0.1/cgi-bin/natp"
BASIC_AUTH=$(echo -n ${LOGIN}:${PWD} | base64)
@mad
mad / mf.html
Created January 17, 2012 21:04
microformat test
<html>
<head>
</head>
<body>
<!--
Test it there:
@mad
mad / nse
Created January 27, 2012 22:46
NSE skeleton for emacs yassnippet
# -*- mode: snippet -*-
# name: nse
# --
description = [[
$0
]]
---
-- @usage
-- nmap --script <this script> <ip>
@mad
mad / mongodb-collection-patch-r27936.diff
Created January 28, 2012 11:50
Trying retrieve collection from mongodb
Index: scripts/mongodb-databases.nse
===================================================================
--- scripts/mongodb-databases.nse (revision 27936)
+++ scripts/mongodb-databases.nse (working copy)
@@ -65,6 +65,20 @@
status, result = mongodb.query(socket, packet)
if not status then return result end-- Error message
+ for k,v in pairs(result["databases"]) do
+ local result2, colls