Skip to content

Instantly share code, notes, and snippets.

View dunnousername's full-sized avatar
💭
Writing esoteric Python code

dunnousername

💭
Writing esoteric Python code
View GitHub Profile
#!/bin/env python3
import argparse
import os
import shutil
import subprocess
def map_playlist(m3u8: str, folder: str):
counter = 0
for line in m3u8.split('\n'):
@dunnousername
dunnousername / schemachecker.py
Created November 20, 2019 21:38
schema.org checker I made in like 5 minutes. Useful for scraping for pages that support schema.org.
#!/usr/bin/python3
# usage: schemachecker.py urls...
# requires: python 3, beautiful soup 4, requests library
from bs4 import BeautifulSoup
import requests
import sys
def checkUrl(url):
r = requests.get(url, headers={'user-agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:10.0) Gecko/20100101 Firefox/10.0'})
@dunnousername
dunnousername / bencode.st
Last active August 11, 2019 22:56
Bencode in smalltalk. (first smalltalk program). bencode_full.st is a later revision that should be able to both encode and decode.
Integer extend [
bencode: stream [
stream nextPutAll: 'i'.
stream nextPutAll: (self storeString).
stream nextPutAll: 'e'.
]
]
OrderedCollection extend [
bencode: stream [
@dunnousername
dunnousername / gmpmathtest.cpp
Created December 21, 2018 22:35
AWS Graviton ARM vs x86 GMP benchmarks
#include <iostream>
#include <chrono>
#include <cstdlib>
#include <gmpxx.h>
using namespace std;
static gmp_randclass rand0 (gmp_randinit_default);
static volatile bool _noopt;
@dunnousername
dunnousername / ctypes.h
Last active August 10, 2018 04:50
Totally untested stdlib files
#define isupper(c) ((c > 0x40) && (c < 0x5B))
#define islower(c) ((c > 0x60) && (c < 0x7B))
#define iscntrl(c) ((c < 0x20) || (c == 0x7F))
#define isdigit(c) ((c >= 0x30) && (c <= 0x39))
#define isspace(c) ((c == ' ') || (c == '\n') || (c == '\r') || (c == '\t'))
#define isprint(c) ((c >= 0x20) && (c <= 0x7E))
#define isgraph(c) (isprint(c) && !isspace(c))
#define isalpha(c) (isupper(c) && islower(c))
#define isalnum(c) (isalpha(c) || isdigit(c))
#define isxdigit(c) (isnum(c) || ((c > 0x40) && (c <= 0x47)) || ((c > 0x60) && (c <= 0x66)))
@dunnousername
dunnousername / Execute.java
Created March 16, 2017 20:41
Beginning of the "MPVM" project... (does not run yet, so can't post in repo)
package me.dunnousername.mpvm;
import com.google.common.util.concurrent.SimpleTimeLimiter;
import java.util.concurrent.Callable;
import java.util.concurrent.TimeUnit;
/**
* Created by dunnousername on 3/16/17.
*/