Skip to content

Instantly share code, notes, and snippets.

#!/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
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):
@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,
//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 / 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>
@phikal
phikal / solarized.xml
Last active October 16, 2020 06:47
Android colors.xml with the Solarized color scheme - http://ethanschoonover.com/
<?xml version="1.0" encoding="utf-8"?>
<!--
Solarized colors.xml (solarized.xml) for Android
by Philip K. [https://dyst.ax.lt/~phi]
-->
<resources>
<!-- hex resources -->
<color name="base03">#002b36</color>
@phikal
phikal / Makefile
Created August 15, 2015 13:09
scattering project for Petnica Pi (Step by Step Photon 3d Simulation)
all: $(ALL)
cc scatter.c -O9 -lm -o scatter
@phikal
phikal / Makefile
Created August 15, 2015 13:11
scattering project for Petnica Pi (Monte Carlo Radiative Transfer Simulation)
all: $(ALL)
cc scatter.c -O9 -lm -o scatter
@phikal
phikal / gist:bf8807bb9cca1ba9c86c
Created September 19, 2015 14:01
palemoon debian package content
drwxr-xr-x 0/0 0 2015-09-19 15:45 ./
drwxr-xr-x 0/0 0 2015-09-19 15:45 ./usr/
drwxr-xr-x 0/0 0 2015-09-19 15:45 ./usr/share/
drwxr-xr-x 0/0 0 2015-09-19 15:45 ./usr/share/doc/
drwxr-xr-x 0/0 0 2015-09-19 15:45 ./usr/share/doc/palemoon/
-rw-r--r-- 0/0 138 2015-09-19 15:45 ./usr/share/doc/palemoon/changelog.Debian.gz
drwxr-xr-x 0/0 0 2015-09-19 15:45 ./usr/share/icons/
drwxr-xr-x 0/0 0 2015-09-19 15:45 ./usr/share/icons/hicolor/
drwxr-xr-x 0/0 0 2015-09-19 15:45 ./usr/share/icons/hicolor/128x128/
drwxr-xr-x 0/0 0 2015-09-19 15:45 ./usr/share/icons/hicolor/128x128/apps/
@phikal
phikal / create.sh
Created September 29, 2015 19:17
Create Palemoon package via fpm
#!/bin/bash
# usage: ... [archive] [package type]
NAME=palemoon
MAINT="[email protected]"
LICE="MPLv3.0"
URL="http://www.palemoon.org/"
VERSION=$(echo $1 | sed 's/^palemoon-//' | sed 's/.en-US.*$//')
ARCH=$(echo $1 | sed 's/^.*linux-//' | sed 's/.tar.bz2$//')