Skip to content

Instantly share code, notes, and snippets.

View danthedaniel's full-sized avatar
👨‍💻
⠠⠵

Daniel danthedaniel

👨‍💻
⠠⠵
View GitHub Profile
@danthedaniel
danthedaniel / log.py
Last active August 29, 2015 14:24
Scans through one month of Reddit mod log history and outputs a .csv
# Reddit mod log parser
# Author: teaearlgraycold
#
# Scans through one month of mod log history and outputs a .csv, the first
# column being the date of the mod actions, and each subsequent column the
# count of mod actions for each moderator (only includes moderators currently
# registered to the subreddit).
#
# So each line ends up being a summary for that day's moderator activity.
#!/bin/bash
# Author: teaearlgraycold
# Builds Spigot.jar and places it in the current directory.
CURRENTDIR=`pwd`
BUILDDIR=/tmp/spigot-buildtools
if ! [ -x "$(command -v git)" ]; then
echo "Installing git"
sudo apt-get update
@danthedaniel
danthedaniel / keybase.md
Created February 15, 2017 15:46
Keybase Proof

Keybase proof

I hereby claim:

  • I am teaearlgraycold on github.
  • I am teaearlgraycold (https://keybase.io/teaearlgraycold) on keybase.
  • I have a public key ASDOZ0Puk-IW-N2cxcr3anGElG0CJmoyBowYR7IibTdPcQo

To claim this, I am signing this object:

@danthedaniel
danthedaniel / issue_reporting.js
Last active February 27, 2017 20:27
Automatically generate a CSV from a page of GitHub issues
/* This script is meant to be ran in the development console of your browser,
* and executed while on the GitHub issues page.
* Edit it as needed to match your issues.
*/
var query_list = (elem, query) => {
return Array.prototype.slice.call(elem.querySelectorAll(query));
};
var priority_labels = ['High', 'Medium', 'Low'];
@danthedaniel
danthedaniel / reddit_place.py
Last active April 1, 2017 04:48
Python script for scraping reddit place
import requests
import re
import sys
import time
import json
import sqlite3
from websocket import create_connection, WebSocket
colors = [
@danthedaniel
danthedaniel / bitmap_to_png.py
Last active April 3, 2017 21:04
Convert reddit /r/place bitmap to a png
import requests
from PIL import Image
bitmap_width = 1000
bitmap_height = 1000
colours = [
(0xff, 0xff, 0xff), # #FFFFFF
(0xe4, 0xe4, 0xe4), # #E4E4E4
(0x88, 0x88, 0x88), # #888888
(0x22, 0x22, 0x22), # #222222
@danthedaniel
danthedaniel / crystal_binary_size_comparison.md
Last active August 25, 2018 23:46
Comparison of Crystal and C binary sizes

Crystal Source Code:

def factorial(n)
    n < 2 ? 1 : n * factorial(n - 1)
end

if ARGV.size > 0
    n = ARGV.first.to_u64
 puts factorial(n)
@danthedaniel
danthedaniel / config.py
Last active July 10, 2017 07:39
Reversible BNF in TPOT
import numpy as np
classifier_config_dict_light = {
# Classifiers
'sklearn.naive_bayes.GaussianNB': {
},
'sklearn.naive_bayes.BernoulliNB': {
'alpha': [1e-3, 1e-2, 1e-1, 1., 10., 100.],
@danthedaniel
danthedaniel / katex_auto.js
Created August 26, 2017 18:33
Tiny automatic KaTeX rendering.
// Automatically render all elements of type pre.math as latex equations.
(function() {
var math_elements = document.querySelectorAll('pre.math');
math_elements.forEach(function(e) {
e.innerHTML = katex.renderToString(e.innerText);
});
})();
@danthedaniel
danthedaniel / tms.py
Created January 10, 2018 02:19
Drexel Term Master Schedule scraper
import bs4 as bs
import sqlite3
import requests
import datetime
def db_setup(conn):
c = conn.cursor()
c.execute("""CREATE TABLE IF NOT EXISTS classes (
subject_code TEXT,