Skip to content

Instantly share code, notes, and snippets.

@blha303
blha303 / newdomain.sh
Created February 16, 2016 17:43
Generate a CSR for a domain
#!/bin/bash
openssl rsa -in account.key -pubout 2>&1 | grep -v "writing"
echo "press enter..." >&2
read enter
openssl req -new -sha256 -key domain.key -subj "/" \
-reqexts SAN -config <(cat /etc/ssl/openssl.cnf \
<(printf "[SAN]\nsubjectAltName=DNS:$1"))
@blha303
blha303 / start_weechat.py
Created February 9, 2016 08:30
A flask web server to start/stop weechat for a Glowing Bear connection. Intended for people who have push notifications set up in their bouncer that only come through when no clients are connected
from flask import *
from subprocess import check_output, CalledProcessError
app = Flask(__name__)
@app.route('/')
def index():
if request.args.get("pw", None) and request.args["pw"] == "somepassword":
if "start" in request.args:
try:
@blha303
blha303 / genius.py
Last active February 3, 2016 12:28
Get lyrics from genius.com (remade because I pushed the token :P)
#!/usr/bin/env python3
# reqs: requests, beautifulsoup4
from bs4 import BeautifulSoup as Soup
from requests import get
from argparse import ArgumentParser
import sys
CLIENT_ACCESS_TOKEN = "" # generate at https://genius.com/api-clients
def main():
// javascript:(prompt("Your shortened URL is", "http://www.ebay.com/itm/" + document.getElementsByClassName('sw_email')[0].getAttribute("data-itemid")))()
prompt("Your shortened URL is",
"http://www.ebay.com/itm/" + document.getElementsByClassName('sw_email')[0].getAttribute("data-itemid")
)
#!/usr/bin/env python3
from requests import get
from os import environ
from sys import exit, stderr, stdout
STDOUT = stdout
# http://stackoverflow.com/a/1094933
def sizeof_fmt(num, suffix='B'):
for unit in ['','Ki','Mi','Gi','Ti','Pi','Ei','Zi']:
@blha303
blha303 / aaList.md
Last active January 14, 2016 12:48
YMS srts. These sub files have been checked against the source video on youtube
@blha303
blha303 / torrenttags.py
Last active February 6, 2016 08:58
A script to look up claims on a torrent via TorrentTags.
#!/usr/bin/env python3
__usage__ = """
usage: torrenttags [-h] [--html] hash
positional arguments:
hash Torrent hash to look up
optional arguments:
-h, --help show this help message and exit
--html Prints html response to stdout, includes Chilling Effects
@blha303
blha303 / compliment.b303.me.py
Last active June 25, 2021 04:41
Gets random comment from /r/gonewild, since they're pretty much all compliments. http://compliment.b303.me Warning: May contain sexual content
#!/usr/bin/env python3
import requests
from flask import *
import random
from apscheduler.schedulers.background import BackgroundScheduler
app = Flask(__name__)
scheduler = BackgroundScheduler()
url = "https://reddit.com/r/gonewild/comments.json?limit=200"
<?php
if (isset($_GET['print'])) {
highlight_file(__FILE__);
die();
}
function load_addon($filename) {
if (file_exists($filename)) {
include $filename;
}
}
@blha303
blha303 / add_bytes.py
Created November 21, 2015 14:35
A script to sum byte values (e.g 7TB + 512GB = 7.5TB)
#!/usr/bin/env python3
import argparse
import sys
SYMBOLS = ('kilo', 'mega', 'giga', 'tera', 'peta', 'exa', 'zetta', 'iotta')
def get_bytes(data_queue):
"""Parses list of strings, ints or floats representing data amounts (e.g 1MB, 2mb, 3M) to a list of bytes. Parses all types listed in SYMBOLS.