(add this section to your readme.md)
MineRobber9000 - all of the "Button Clicker" style code.
| import requests | |
| class ChanInfoError(Exception): | |
| pass; | |
| class OfflineStreamOBJ: # fix for offline streams backported from APIv5 version | |
| def __init__(self,id,name): | |
| self.id = id | |
| self.name = name # we know the name for sure so we can use it | |
| self.message = "[OFFLINE]" |
PyMod is a library I wrote in the course of writing a Brainfuck to Python compiler. It allows programmatic generation of python programs/modules. Methods of the Program class are:
Adds an import to the module. Takes arguments where moduleName is the name of a module or feature, and futureImport is a boolean
stating if the first argument is a module or feature. (defaults to False)
Adds a line to the program. Takes argument line which is the line to add.
| local function _W(f) local e=setmetatable({}, {__index = _ENV or getfenv()}) if setfenv then setfenv(f, e) end return f(e) or e end | |
| print("BASIC interpreter?") | |
| print("Programmer lazy.") | |
| print("Understandable, have a great day!") |
| function MRANK(value,values) { | |
| var values = values.map(function(x) { return x[0]; }); // apparently I misjudged how Google Sheets passes values. Why is it like this?!?! | |
| var valuesSorted = values.sort(function(a,b){ return b-a; }); | |
| var valuesUnique = valuesSorted.filter(function(value,index,self) { return self.indexOf(value) === index; }); | |
| var index = valuesUnique.indexOf(value); | |
| if (index<0) { | |
| throw("MRANK has no valid input data"); | |
| } | |
| return index+1; | |
| } |
| #!/usr/bin/python3 | |
| import argparse | |
| # This is the list of words that will be used to search for the word. | |
| # Format is one word per line. | |
| # The script will ignore lines starting with a hash. | |
| WORDLIST = "/usr/share/dict/words" # default word list on most Linux boxen | |
| def str_sorted(word): | |
| """Returns a string with sorted characters.""" |
| import csv,sys | |
| assert len(sys.argv) in (2,3),"Usage: csv2md.py <input_file> [output_file]" | |
| # assumes top row is table headers | |
| with open(sys.argv[1]) as f: rows = list(csv.reader(f)) | |
| max_row_length = max(*[len(r) for r in rows]) | |
| for row in rows: |
| import sqlite3, csv, sys, re | |
| DIGIT = re.compile("0([box])(\d+)") | |
| def get_type(s): | |
| if s.isdigit(): return "INTEGER", int | |
| m = DIGIT.match(s) | |
| if not m: return "TEXT", str | |
| base, num = m.groups() | |
| if base=="x": return "INTEGER", lambda x: int(x,16) | |
| elif base=="o": return "INTEGER", lambda x: int(x,8) |
| #!/usr/bin/env python3 | |
| import requests, argparse, configparser, os.path, json | |
| config = configparser.ConfigParser() | |
| config.read(os.path.expanduser("~/.config/github.ini")) | |
| creds = config["credentials"] | |
| def read_file(fn): | |
| with open(fn) as f: return dict(content=f.read()) |