Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/python3
import os, sys
import pyudev
import subprocess
import time
import shutil
import argparse
from pathlib import Path
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import os, sys
import threading, queue
import requests
from tqdm import tqdm
BUF_SIZE = 0x1000
TIMEOUT = 3
@averne
averne / color.hpp
Created April 10, 2019 17:39
C++ templates for pixel data
#pragma once
#include <cstdint>
#include <utility>
#include <type_traits>
#define ASSERT_SIZE(x, sz) static_assert(sizeof(x) == sz, "Wrong size in " #x)
#define ASSERT_STANDARD_LAYOUT(x) static_assert(std::is_standard_layout_v<x>, #x "is not standard layout")
struct rgb565_t {
@averne
averne / Makefile
Created April 19, 2019 08:15
VSCode Linux project
TARGET = $(notdir $(CURDIR))
EXTENSION = elf
OUT = out
RELEASE = release
DEBUG = debug
SOURCES = src
INCLUDES =
LIBS =
ARCH = -march=native -fpie
@averne
averne / async_logger.cpp
Last active July 21, 2019 14:22
Asynchronous logger for the Switch
#include <cstdio>
#include <cstring>
#include <cmath>
#include <string>
#include <switch.h>
#include "async_logger.hpp"
Result AsyncLogger::start() {
if (is_running()) return -1;
@averne
averne / kbd_idle.py
Last active October 20, 2019 18:47
Keyboard backlight timeout script
#!/usr/bin/python3
# Needs packages python-dbus & python-gobject
# ~/scripts/kbd_idle.sh:
# !/bin/sh
# cd ~/scripts
# exec python3 kbd_idle.py &
@averne
averne / .zshenv
Last active June 17, 2020 16:59
Zsh dotfiles
# .zshenv
export ZDOTDIR=~/.config/zsh
export DEVKITPRO=/opt/devkitpro
export DEVKITARM=${DEVKITPRO}/devkitARM
export DEVKITPPC=${DEVKITPRO}/devkitPPC
export PATH=${DEVKITPRO}/tools/bin:$PATH
@averne
averne / main.c
Created February 11, 2020 17:21
Listing dir contents with raw fs calls
#include <stdio.h>
#include <switch.h>
int main(int argc, char **argv) {
consoleInit(NULL);
FsFileSystem sd_fs;
Result rc = fsOpenSdCardFileSystem(&sd_fs);
if (R_FAILED(rc))
printf("Failed to open sd filesystem: %#x", rc);
@averne
averne / fs.hpp
Last active February 27, 2020 16:29
#pragma once
#include <cstdint>
#include <string>
#include <vector>
#include <switch.h>
#include "error.hpp"
#include "utils.hpp"
#!/bin/python2
import os, sys
import re
import lib.nxo64 as nxo64
def main(pattern, filename):
f = nxo64.load_nxo(open(filename, 'rb'))
f.binfile.seek(0)