Skip to content

Instantly share code, notes, and snippets.

@rebane2001
rebane2001 / keybase.md
Created September 25, 2018 14:50
Verification of sorts

Keybase proof

I hereby claim:

  • I am rebane2001 on github.
  • I am rebane2001 (https://keybase.io/rebane2001) on keybase.
  • I have a public key ASCRS5qGKG2CuxsPwvZ2BH_VFLOnVh4iHspFOYTiFpbhjwo

To claim this, I am signing this object:

#NOTE = ONLY WORKS IN PYTHON 3 (MAYBE WORKS IN PYTHON 2 I HAVNe' TESTED")
import os
import sys
import urllib.request
print("Supports INFINITE LENGHT (unlimited)")
len = input("Enter how many letters do you want (no support for words in 1.0 version yet):")
File_Name = "lorem.txt"
OUTPUTXT = ""
urllib.request.urlretrieve ("https://en.wikipedia.org/wiki/Lorem_ipsum", File_Name)
with open("lorem.txt","r") as loremtxt1:
@rebane2001
rebane2001 / fotoalbum-dl.py
Created September 30, 2020 13:07
Laeb alla fotoalbum.ee albumeid
import urllib.request
import re
base_url = "http://fotoalbum.ee"
album = input("Sisesta fotoalbum.ee albumi link:")
album = album.split("?")[0]
if not "/sets/" in album:
print("Hoiatus: Link pole album ning võib seetõttu valesti toimida")
pildid = []
@rebane2001
rebane2001 / tähed.py
Last active October 2, 2020 15:44
Skript, mis annab tähtede kohta statistikat sõna kohta. Pole just parim lahendus, kuid kui keegi viitsib selle funktsiooniks valmis kirjutada saab ka oma projektides kasutada
# Siia tuleb sõna mille kohta on soov info leida
sona = "kuulilennuteetunneliluuk"
tüübid = {
"Tagavokaalid": "uõoa",
"Eesvokaalid": "iüeöä",
"Täishäälikud": "aeiouõöäü",
"Kaashäälikud": "jlmnrszhfšžkgpbtd",
"Helilised häälikud": "aeiouõöäüjlmnrv",
"Helitud häälikud": "szhfšžkgpbtd",
@rebane2001
rebane2001 / lasermouse.py
Created September 27, 2018 19:19
Simple script to control your mouse pointer with a laser and a webcam (only works on Windows)
import cv2
import numpy as np
import win32api, win32con
import math
webcam_x = 640 #Set webcam resolution
webcam_y = 640
screen_x = 1280 #Set screen resolution
screen_y = 1024
# Simple script to convert trs files to srt. May not be perfect, so edit this script as necessary.
# Warning, this script is unsafe to use against untrusted data.
# See for more info: https://docs.python.org/3/library/xml.html#xml-vulnerabilities
from datetime import timedelta
from xml.dom import minidom
import srt
subs = []
@rebane2001
rebane2001 / bilibiliextract.py
Created June 2, 2021 10:06
Simple script to extract bilibili video IDs/URLs from a channel ID/URL
# Simple script to extract all video IDs from a bilibili channel
# Not properly cleaned up for public release, so you're on your own
import requests
import json
import re
def getChannelPageVideos(channelid,page):
print("Getting page",page)
headers = {
'authority': 'api.bilibili.com',
@rebane2001
rebane2001 / patch.py
Last active July 6, 2021 11:11
matterport-dl expiration patch
import re
import os.path
for p in ["showcase.js","js/showcase.js"]:
if os.path.isfile(p):
with open(p,"r",encoding="UTF-8") as f:
j = f.read()
with open(p,"w",encoding="UTF-8") as f:
f.write(re.sub(r"\&\&\(!e.expires\|\|.{1,10}\*e.expires>Date.now\(\)\)","",j))
print("Patched!")
Archive what you'll never see twice
Whatever you did years ago, it changed you. For the better, and that's nothing you can throw away, delete, or unlist.
(from https://flowny.bandcamp.com/track/stand-alone-by-combine-feat-feather)
The reality is that things you want will disappear and things you don’t will be around for forever.
(from https://www.bbc.com/future/article/20210715-the-online-data-thats-being-deleted)
@rebane2001
rebane2001 / daily_metadata.py
Created July 17, 2021 19:56
Somewhat hastily written script to pull metadata for every video in an archive (recommended to cronjob to every day)
import requests
import re
import os
import time
import json
from datetime import datetime, timezone
import random
# Put your YouTube API keys here, the more the merrier (one key can do 500k vids a day)
youtube_api_keys = ["YOUR_API_KEYS_HERE"]