Skip to content

Instantly share code, notes, and snippets.

@blha303
blha303 / portopen.php
Created January 28, 2017 11:50
A script to check if a given port is open on the connecting host. IP ranges included are for cloudflare, replace with an array containing your proxy server IP ranges
<?php
// A script to check if a given port is open on the connecting host.
// IP ranges included are for cloudflare, replace with an array containing your proxy server IP ranges
// https://b303.me/portopen.php?port=80
header("Content-Type: application/json");
header("Access-Control-Allow-Origin: *");
function cidr_match($ip, $ranges) {
$out = array();
foreach ($ranges as $range) {
list ($subnet, $bits) = explode('/', $range);
@blha303
blha303 / plexnp.py
Last active December 3, 2022 21:04
A script to report what people are watching on your Plex server
from plexapi.server import PlexServer
import sys
plex = PlexServer("http://172.16.17.10:32400")
now_playing = plex.query("/status/sessions")
if not now_playing:
print("Nobody's watching anything")
sys.exit(0)
sessions = []
def hms(mil):
s,mil = divmod(int(mil), 1000)
@blha303
blha303 / gameservers.py
Last active February 8, 2017 18:07
A script to log into Steam and list game servers
#!/usr/bin/env python
from __future__ import print_function
import sys
try:
import requests
from bs4 import BeautifulSoup as Soup
from Crypto.PublicKey import RSA
from Crypto.Cipher import PKCS1_v1_5
import yaml
@blha303
blha303 / krpanodl.py
Created January 22, 2017 08:40
A script to download images from a krpano. Made for the CNN gigapixel panorama of Trump's inauguration
cubelabels = "fblrud"
levels = ["l"+i for i in range(1,8)]
skipped = 0
for s in cubelabels:
for l in levels:
for v in range(1,999):
for h in range(1,999):
req = requests.get("http://europe.tiles.fanpic.co/749-2017-cnn/mres_{s}/{l}/{v}/{l}_{s}_{v}_{h}.jpg".format(s=s,l=l,v=v,h=h), stream=True)
if req.status_code == 200:
with open("{l}_{s}_{v}_{h}.jpg".format(s=s,l=l,v=v,h=h), "wb") as f:
function pokeAll(){
buttons = document.getElementsByClassName("_42ft _4jy0 _4jy3 _4jy1 selected _51sy");
for (var i = 0; i < buttons.length; i++) {
if (buttons[i].innerText == "Poke Back") {
buttons[i].click()
}
}
setTimeout(pokeAll, 1000)
}
pokeAll()
@blha303
blha303 / dcirc.py
Created December 19, 2016 09:08
A non-working attempt at an integration between IRC and the AirDC web ui's hub chat
#!/usr/bin/env python3
import irc3
import websockets
import asyncio
import json
@irc3.plugin
class DCIRC:
requires = ["irc3.plugins.command"]
@blha303
blha303 / comicviewer.html
Last active December 7, 2016 17:42
A comic viewer. Edit the variables at the top of the script tag to suit your comic files. https://b303.me/concerned/
<html>
<head>
<script>
// Comic Viewer by blha303 https://github.com/blha303
// BSD license
// Please leave this header here
// Below settings are for a folder of images named 'concerned000.jpg'-'concerned205.jpg'
prefix = "concerned" // Filename prefix
suffix = ".jpg" // Filename suffix or extension
@blha303
blha303 / guitartabs.html
Last active December 12, 2016 14:13
A javascript thing to get guitar tab charts quickly. https://b303.me/guitartabs.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>GuitarTabGenerator</title>
</head>
<body>
<form id="form">
<input type="text" id="tabs" style="width:70%" value="G F# Ab C">
<input type="submit">
@blha303
blha303 / uketabs.html
Last active December 12, 2016 14:05
A javascript thing to get ukulele tab charts quickly. https://b303.me/uketabs.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>UkeTabGenerator</title>
</head>
<body>
<form id="form">
<input type="text" id="tabs" style="width:70%" value="E♭|F7|B♭7|G♭" autofocus>
<input type="submit">
@blha303
blha303 / neuralnet.py
Last active November 28, 2016 09:11
I wanted to try my hand at making a neural net kinda thingy
from __future__ import print_function
import sys,random
# http://stackoverflow.com/a/31505798
import re
caps = "([A-Z])"
prefixes = "(Mr|St|Mrs|Ms|Dr)[.]"
suffixes = "(Inc|Ltd|Jr|Sr|Co)"
starters = "(Mr|Mrs|Ms|Dr|He\s|She\s|It\s|They\s|Their\s|Our\s|We\s|But\s|However\s|That\s|This\s|Wherever)"
acronyms = "([A-Z][.][A-Z][.](?:[A-Z][.])?)"