Skip to content

Instantly share code, notes, and snippets.

View AndreasLonn's full-sized avatar

AndreasLonn

View GitHub Profile
@AndreasLonn
AndreasLonn / JUTools.user.js
Last active February 13, 2025 14:53
Tools for students and teachers at Jönköping University
// ==UserScript==
// @name JU Tools
// @namespace http://tampermonkey.net/
// @version 2.16
// @description Tools for students and teachers at Jönköping University
// @author AndreasLonn
// @downloadURL https://gist.github.com/AndreasLonn/c5f12b1704c748a9bc18786ea295aedc/raw/JUTools.user.js
// @updateURL https://gist.github.com/AndreasLonn/c5f12b1704c748a9bc18786ea295aedc/raw/JUTools.user.js
// @run-at document-start
// @match https://ju.instructure.com/*
@AndreasLonn
AndreasLonn / hjalpfunktioner.cpp
Last active November 25, 2021 11:38
Add these files to your project directory. Then use the header file 'hjalpfunktioner.h' (#include "hjalpfunktioner.h") to use the functions in your program
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
/**
* @brief Converts an integer to a string in base 2 (binary)
*
* @param num Integer to convert to string
@AndreasLonn
AndreasLonn / checklist.html
Created October 12, 2021 14:53
A serverless HTML checklist that is run locally. Checked items are stored in localstorage in the web browser
<!--
This is a serverless checklist that is run locally. Checked items are
stored in localstorage in the web browser.
The content is stored as a javascript array for quick interpretation.
The indentation of the array is ignored. The number first number in the
array in the list array represents the indentation, while the string
is the text to be displayed. The strings are NOT escaped, so the strings
can contain HTML elements like links.
-->
<!DOCTYPE html>
@AndreasLonn
AndreasLonn / 1-xbox-controller.py
Created October 10, 2021 17:36
Script to emulate keyboard or mouse actions with Xbox controller. Tested on Windows 10 with Xbox One S controller over both bluetooth and micro-USB cable. Can run in background. IMPORTANT: Remove the '2-' in the config file name. It is used to order the files correctly
# How to use:
# This script requires: pygame, configparser, keyboard and mouse
# Tested on Windows 10 with Xbox One S controller
# over both bluetooth and micro-USB cable
# The config file ('config.ini') is stored in the same directory as the script
# The available keys are:
# For normal keys, see https://github.com/boppreh/keyboard#keyboard.send
# For mouse click, use "!m:click:" followed by button
# from https://github.com/boppreh/mouse#mouse.click
# For mouse movement, use "!m:move:hori" or "!m:move:vert"
@AndreasLonn
AndreasLonn / youtube-download.py
Created October 10, 2021 12:42
The script can either take command line arguments or, if none is supplied, ask for it. Usage with command line arguments: python3 youtube-download.py link-to-YouTube-video where-to-download
# The script can either take command line arguments or, if none is supplied,
# ask for it
# Usage with command line arguments:
# python3 youtube-download.py link-to-YouTube-video where-to-download
from pytube import YouTube
import subprocess, sys
# Get the YouTube link and where to save the file