Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/python
# -*- coding: utf-8 -*-
import argparse
import os
import random
import string
import tempfile
import binascii
import sys
import subprocess
@mid-kid
mid-kid / rocketpi-motd.sh
Last active December 12, 2015 07:09 — forked from piksel/raspi-motd.sh
Modified raspi-motd.sh. Thanks to piksel for the template
#!/bin/bash
logo="$(tput setaf 2)
.~~. .~~.
'. \ ' ' / .' $(tput sgr0) _ $(tput setaf 1)
.~ .~~~..~. $(tput sgr0) _ _| |_ _ $(tput setaf 1)
: .~.'~'.~. : $(tput sgr0) ___ ___ ___| |_ _|_ _| ___|_|$(tput setaf 1)
~ ( ) ( ) ~ $(tput sgr0) | _| . | _| //| -_| |_ | . | |$(tput setaf 1)
( : '~'.~.'~' : ) $(tput sgr0) |_| |___|___|___|___|___| | _|_|$(tput setaf 1)
~ .~ ( ) ~. ~ $(tput sgr0) |_| $(tput setaf 1)
@mid-kid
mid-kid / Cinnamon-Network-Connections-Shortcut.py
Last active December 14, 2015 11:58
Adds a new Network Manager applet with a network connections shortcut in Cinnamon
import shutil
import os
try:
shutil.rmtree(os.environ["HOME"]+"/.local/share/cinnamon/applets/custom-network@example.com/")
except:
pass
shutil.copytree("/usr/share/cinnamon/applets/network@cinnamon.org/", os.environ["HOME"]+"/.local/share/cinnamon/applets/custom-network@example.com/")
os.chdir(os.environ["HOME"]+"/.local/share/cinnamon/applets/custom-network@example.com/")
@mid-kid
mid-kid / region.py
Created February 4, 2015 17:28
Regionfree patcher for 3ds game
import sys
with open(sys.argv[1], "r+b") as f:
f.seek(0x2018)
f.write("\xFF\xFF\xFF\x7F")
f.close
@mid-kid
mid-kid / messagetool.py
Created September 26, 2015 10:34
Unpack and repack Pokemon Super Mystery Dungeon's message.bin
from sys import argv
from struct import unpack, unpack_from, pack
from os import makedirs
from os.path import isdir
from json import dumps, loads
def unpack_wchar_str_from(bytes, pos):
string = b""
@mid-kid
mid-kid / dotnet-generate-source.sh
Last active November 21, 2021 17:17
Generate a tarball from dotnet/source-build
#!/bin/sh
set -e
# Script to generate a semi-reproducible dotnet source tarball
# The only differences accross builds are in the git-info/ directory,
# the OfficialBuildId being generated based on the current date.
# See tools-local/tasks/Microsoft.DotNet.SourceBuild.Tasks.XPlat/WriteSourceRepoProperties.cs
version="v${1:-5.0.209.1}-SDK"
@mid-kid
mid-kid / Dummy RSF
Last active July 23, 2023 20:07
Dummy .rsf file for 3DS games
Dummy .rsf file for 3DS games
@mid-kid
mid-kid / mb2gba.s
Last active October 22, 2023 06:50
Convert GBA multiboot game to cartridge format
@ Bootstrap for running a GBA multiboot game stored in a ROM cartridge
@ Assemble with:
@ arm-none-eabi-as -o mb2gba.o mb2gba.s
@ arm-none-eabi-objcopy -O binary mb2gba.o mb2gba.bin
@ base64 mb2gba.bin
start:
@ Copy the game into ram
mov r0, #0x04000000
@mid-kid
mid-kid / hslogin-nstrein
Last active November 15, 2023 20:21
WiFi in de trein auto login script
#!/bin/sh
# Logs in automatically to the "WiFi in de trein" public hotspots, located in
# trains in the Netherlands.
# Requires: curl, sed
set -e
tmp="$(mktemp -d -p '' 'hslogin.XXXXXXXXXX')"
trap "rm -r '$tmp'" EXIT
curl="curl --dns-servers 8.8.8.8,8.8.4.4 -s -v -m 30"
@mid-kid
mid-kid / checktray.c
Last active January 1, 2024 23:00
Check for the presence of an Xembed tray on linux X11
#include <stdlib.h>
#include <stdio.h>
#include <X11/Xlib.h>
// Simple program to check for the presence of an Xembed tray
// Exits with status 0 if the tray exists
int main()
{
Display *d = XOpenDisplay(NULL);