Skip to content

Instantly share code, notes, and snippets.

@phikal
phikal / mhsc.html
Created May 3, 2015 19:50
Minimal HTTP Submission Client for 4jhan (https://github.com/phikal/4jhan-server)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Minimal HTTP Submission Client</title>
</head>
<body>
<h1>4jhan MHSC</h1>
<i>Minimal HTTP Submission Client for 4jhan</i><br>
<a href='http://localhost:3000/list'>View List</a>
//Optparse.js 1.0.3-Copyright (c)2009 Johan Dahlberg
//Based on:https://github.com/jfd/optparse-js
//Compressed and removed some redundant features by @phikal
var optparse={};try{optparse=exports;}catch(e){}(function(self){var VERSION='1.0.3';var LONG_SWITCH_RE=/^--\w/,SHORT_SWITCH_RE=/^-\w/,EXT_RULE_RE=/(\-\-[\w_-]+)\s+([\w\[\]_-]+)|(\-\-[\w_-]+)/,ARG_OPTIONAL_RE=/\[(.+)\]/,DEFAULT_FILTER='_DEFAULT',PREDEFINED_FILTERS={};function filter_text(value){return value;}PREDEFINED_FILTERS[DEFAULT_FILTER]=filter_text;PREDEFINED_FILTERS.TEXT=filter_text;function build_rules(filters,arr){var rules=[];for(var i=0;i<arr.length;i++){var r=arr[i],rule;if(!contains_expr(r))throw OptError('Rule MUST contain an option.');switch(r.length){case 1:rule=build_rule(filters,undefined,r[0]);break;case 2:var expr=LONG_SWITCH_RE.test(r[0])?0:1;varalias=expr===0?-1:0;var desc=alias===-1?1:-1;rule=build_rule(filters,r[alias],r[expr],r[desc]);break;case 3:rule=build_rule(filters,r[0],r[1],r[2]);break;default:case 0:continue;}rules.push(r
@phikal
phikal / sendto bot
Created December 14, 2014 13:02
A bot for Reddit.
#!/usr/bin/env python3
#
# sendto - Reddit bot v1.2
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
BINARY = '01'
OCTAL = '01234567'
DECIMAL = '0123456789'
HEXADEC = '0123456789ABCDEF'
BASE_62 = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
rev = lambda x: dict((c, i) for i, c in enumerate(x))
used = BASE_62
def encode(NUM, base=used):
#!/usr/bin/env python3
from random import randint
from sys import argv
# Dictionary for occ.
res = {}
for rv1 in range(int(argv[1])):
# Generate RG String