Skip to content

Instantly share code, notes, and snippets.

View spookyahell's full-sized avatar
🌐
Browsing the WWW (and helping others and myself get through life)

spookyahell

🌐
Browsing the WWW (and helping others and myself get through life)
View GitHub Profile
// ==UserScript==
// @name Test
// @version 1.0.0
// @namespace @XOR
// @include *google.com*
// @grant GM.notification
// @grant GM.openInTab
// @grant GM.setClipboard
// ==/UserScript==
@spookyahell
spookyahell / apartmentSearch.py
Created August 24, 2018 11:08
How to search for an apartment (assuming you're a dev)
from apartmentSearchProvider import searchExposes
from internetprovider import CheckIfInetProviderOffersBestInternet
closer_cosideration = []
exposes = searchExposes(desiredRegion)
for expose in exposes:
address = expose.address
bestinet = CheckIfInetProviderOffersBestInternet(address)
if bestinet is True:
closer_consideration.append(expose)
@spookyahell
spookyahell / GTDU.py
Created August 25, 2018 22:17
python-requests: Get that nasty URL right now!
def GTDU(u, timeout, RT = 0, CE = 0, headers = None):
try:
r = requests.get(u, timeout = timeout, headers = headers)
return r
except requests.exceptions.ReadTimeout:
RT += 1
if RT<5:
r = GTDU(u, timeout, RT = RT, CE = CE, headers = headers)
return r
else:
@spookyahell
spookyahell / waitforproxytobealive.py
Last active September 20, 2018 16:52
Wait for proxy to be alive again - uses python VLC bindings to play windows notification sound if available and fetch does not return error
import requests
from requests.exceptions import ProxyError
import time
from time import sleep
from importlib import util
pyvlc = False
if util.find_spec('vlc') != None:
from vlc import MediaPlayer, State
@spookyahell
spookyahell / aria2c_analyser.py
Last active September 24, 2018 16:53
Returns the maximum connections per server you can make (can vary if you make a manual build)
from subprocess import check_output
import re
from shutil import which
def getMaxConnPerServer():
x = which('aria2c')
if x is None:
print('You have to add aria2c to your path first')
@spookyahell
spookyahell / getAdUri.py
Last active September 22, 2018 16:16
Ever needed that one YouTube ad downloaded but didn't know how to get the URL? (while watch on your computer) Just copy debug infos to clipboard via right click on the viewer and then run this script. (Run in python3.6+)
import re
from tkinter import Tk
AdDocId = None
text = Tk().clipboard_get()
for line in text.split('\n'):
x = re.search('"ad_docid": "(.+)"', line)
if x:
AdDocId = x.group(1)
@spookyahell
spookyahell / NOSUB.srt
Created September 27, 2018 23:07
Ever need to merge subtitles and need a segment for that... use this..
1
00:00:01,000 --> 00:00:03,000
[NO SUBTITLES]
@spookyahell
spookyahell / fosshub-mkvtoolnix.py
Created November 22, 2018 23:22
Download latest portable x64 version of mkvmerge & Co
import requests
import re
import json
s = requests.Session()
site = 'https://www.fosshub.com/'
downloadAPP = 'MKVToolNix.html'
downloadsite = site + downloadAPP
@spookyahell
spookyahell / relentless_aria2c_download.py
Created November 27, 2018 15:37
download relentlessly (even upon error - but sleep inbetween
from subprocess import call
from time import sleep
WAIT_TIME = 5 * 60
def download():
x = call(largs)
if x == 1:
if args.relentless:
try:
@spookyahell
spookyahell / py
Last active January 2, 2019 15:39
py for Linux - Ever wanted sth like the py launcher but for linux... just copy this do /bin and chmod +x /bin/py to make it executable
#!/usr/bin/python3.6
from subprocess import call
from shutil import which
from sys import exit as sexy_exit, argv
from re import fullmatch
from os import environ
from os.path import join as path_join, isfile
command = 'python3.6'