Skip to content

Instantly share code, notes, and snippets.

View bostrot's full-sized avatar
🕶️
Doing some stuff here and there...

Eric Trenkel bostrot

🕶️
Doing some stuff here and there...
View GitHub Profile
@bostrot
bostrot / crc32_combine.dart
Created April 7, 2023 19:47
CRC32 Combine implementation from zlib in Dart
/// zlib crc32 combine implementation
/// Usage:
///
/// CRC32().combine(checksum1, checksum2, length2); // length of part behind checksum2
///
class CRC32 {
List<int> x2ntable = List<int>.filled(32, 0);
CRC32() {
int n, p;
@bostrot
bostrot / stage5.txt
Created November 19, 2022 09:08
Outcore Stages
function mv(steps) {
for (var i = 0; i < steps; i++) {
MoveForward()
}
}
function tl() {
TurnLeft()
}
@bostrot
bostrot / vscode_creator.sh
Last active July 20, 2024 02:39
VSCode Portable Creator with mingw for Windows and Archives for Mac x64/ARM, Linux x64, Windows x64
#!/bin/bash
VSCODE_OSX_LINK="https://code.visualstudio.com/sha/download?build=stable&os=darwin-universal"
VSCODE_OSXARM_LINK="https://code.visualstudio.com/sha/download?build=stable&os=darwin-arm64"
VSCODE_LINUX_LINK="https://code.visualstudio.com/sha/download?build=stable&os=linux-x64"
VSCODE_WIN_LINK="https://code.visualstudio.com/sha/download?build=stable&os=win32-x64-archive"
VSCODE_OSX_PATH=downloads/vscode-macos-x64
VSCODE_OSXARM_PATH=downloads/vscode-macos-arm
VSCODE_LINUX_PATH=downloads/vscode-linux-x64
@bostrot
bostrot / windows_store_plausible.py
Created November 2, 2021 13:16
Windows Store Analytics (Paid-, Prepaid code data) to Plausible Analytics
##############################################
# Windows Store Analytics to Plausible Event #
# Author: Bostrot #
##############################################
from typing import Text
import requests
import json
urlRequestToken = 'https://login.microsoftonline.com/TENANT_ID/oauth2/token'
@bostrot
bostrot / stackoverflow_fanatics_badge.py
Last active September 24, 2021 12:00
Stackoverflow Fanatics badge automator with daily Telegram notifications
# Run this daily with cron
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
import telegram_send
import time
chrome_options = Options()
chrome_options.add_argument('--headless')
chrome_options.add_argument('--no-sandbox')
@bostrot
bostrot / check_grades.py
Created September 24, 2021 10:56
FH Aachen Grade checker for QIS with telegram notifications
###
# FH Aachen Selenium Grade Checker with Telegram Send for notifications
# Description: Setup telegram-send first with pip3 install telegram_send and then in bash: telegram-send --configure
# Automate with cron e.g.: crontab -e and enter 0 */12 * * * /usr/bin/python3 /path/to/check_grades.py For every 12h.
# Author: Eric Trenkel (@bostrot)
# License: MIT
###
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
@bostrot
bostrot / create_markdown_from_files.cpp
Created January 12, 2021 11:00
This creates a nicely formatted markdown file from all the C++ source code (.cpp and .h) in a given project with multiple subprojects.
#include <iostream>
#include <fstream>
#include <filesystem>
#include <string>
namespace fs = std::filesystem;
int main() {
std::ofstream out("./cpp_snippets.md");
std::string current = "";
@bostrot
bostrot / disgusting_md5_utf16le.cpp
Created July 9, 2020 23:22
Cheap and disgusting md5 utf16le with c++ and nodejs
#include <iostream>
std::string exec(std::string cmd) {
std::string data;
FILE * stream;
const int max_buffer = 256;
char buffer[max_buffer];
cmd.append(" 2>&1");
stream = popen(cmd.c_str(), "r");
@bostrot
bostrot / macropad.ino
Created January 2, 2020 12:57
Simple Arduino / Teensy macro keypad
int button[5];
bool curPressed[5];
bool pressedD = false;
bool pressedM = false;
void setup()
{
Serial.begin(38400);
}
void loop()
@bostrot
bostrot / ticket_handler.js
Created April 10, 2019 14:34
Quick user block
const config = require('../config.js');
const cache = require('./cache.js');
function ticketHandler(bot, ctx) {
ctx.getChat().then(function(chat) {
if (chat.id.toString() === config.staffchat_id) {
// let staff handle that
staffChat(ctx, bot, chat);
} else if (chat.type === 'private') {
// create a ticket and send to staff