Skip to content

Instantly share code, notes, and snippets.

View WorkingRobot's full-sized avatar
🎯
Focusing

Asriel WorkingRobot

🎯
Focusing
View GitHub Profile
@WorkingRobot
WorkingRobot / steamotp.py
Created January 14, 2023 00:48
Converts totp secret to Steam code
# Steam uses the standard totp algorithm but instead of displaying the value modulo 1000000, it converts the value to a base26 string
# Take the uri from the generated .maFile from https://github.com/Jessecar96/SteamDesktopAuthenticator
# Make sure to select no encryption so you can open the json from a text editor
# Ported from https://github.com/geel9/SteamAuth/blob/96ca6af3eb03d1a45f7fbff78851f055ba47c0d4/SteamAuth/SteamGuardAccount.cs#L85
from base64 import b32decode
from hmac import digest
from time import time
@WorkingRobot
WorkingRobot / gitea-actions.py
Created May 1, 2022 08:01
Link your GitHub Actions to Gitea's CI API
#!/usr/bin/python3
import hashlib, hmac
import humanize
import json
import requests
from dateutil import parser
from http.server import HTTPServer, BaseHTTPRequestHandler
BIND_IP = "127.0.0.1"
import requests, gzip, os
import xml.etree.ElementTree as ET
# Download from https://github.com/EpicGames/UnrealEngine/master/Engine/Build/Commit.gitdeps.xml and store it to the current directory
# Downloaded files will be put in current directory
manifest = ET.parse("Commit.gitdeps.xml").getroot()
files = []
for file in manifest.find("Files"):
if "Oodle" in file.attrib["Name"] and "Sdk" in file.attrib["Name"]:
files.append(file)
@WorkingRobot
WorkingRobot / asteroids.min.js
Created September 2, 2021 22:22
websiteasteroids.com JS code (its https certificate expired)
(function(){function Asteroids(){if(!window.ASTEROIDS)
window.ASTEROIDS={enemiesKilled:0};function Vector(x,y){if(typeof x=='Object'){this.x=x.x;this.y=x.y;}else{this.x=x;this.y=y;}};Vector.prototype={cp:function(){return new Vector(this.x,this.y);},mul:function(factor){this.x*=factor;this.y*=factor;return this;},mulNew:function(factor){return new Vector(this.x*factor,this.y*factor);},add:function(vec){this.x+=vec.x;this.y+=vec.y;return this;},addNew:function(vec){return new Vector(this.x+vec.x,this.y+vec.y);},sub:function(vec){this.x-=vec.x;this.y-=vec.y;return this;},subNew:function(vec){return new Vector(this.x-vec.x,this.y-vec.y);},rotate:function(angle){var x=this.x,y=this.y;this.x=x*Math.cos(angle)-Math.sin(angle)*y;this.y=x*Math.sin(angle)+Math.cos(angle)*y;return this;},rotateNew:function(angle){return this.cp().rotate(angle);},setAngle:function(angle){var l=this.len();this.x=Math.cos(angle)*l;this.y=Math.sin(angle)*l;return this;},setAngleNew:function(angle){return this.cp().setAngle(angle);},setLeng