Skip to content

Instantly share code, notes, and snippets.

Avatar

David Konsumer konsumer

View GitHub Profile
@konsumer
konsumer / mdn_canvas.js
Created Sep 14, 2021
Generate JSOn from MDN docs
View mdn_canvas.js
// I use this to generate a stub from MDN docs about canvas
// run with deno run --allow-net tools/getdocs.js
/* global fetch */
import { DOMParser } from 'https://deno.land/x/deno_dom/deno-dom-wasm.ts'
function getDocs (doc, parent) {
const info = {}
if (doc?.querySelectorAll) {
View protonge_setup.sh
#!/bin/bash
if (! whiptail --title "Proton GE Setup" --yesno "This tool assumes you are running ubuntu/pop/etc 20.10. Are you?" 8 78); then
echo "Run it again, when you get a cool OS. 😂"
exit 1
fi
if (whiptail --title "Proton GE Setup" --yesno "What kind of video card do you have, gamer?" 8 78 --no-button "AMD" --yes-button "NVidia"); then
CARD=NVIDIA
else
@konsumer
konsumer / install-apple-fonts.sh
Created Jun 15, 2021
This will install Apple SF & NY fonts on Linux. Tested on Pop!OS (similar to Ubuntu) 20.10.
View install-apple-fonts.sh
#!/bin/bash
# Install Apple fonts on Linux
# requires p7zip-full installed
getFont() {
NAME=$1
APPLENAME=$2
DIR=$3
DIR=${DIR:="/tmp"}
@konsumer
konsumer / emu.sh
Last active May 21, 2021
Choose the correct retroarch core, based on file-extension, and just run it.
View emu.sh
#!/usr/bin/bash
# Run correct core for a ROM, based on extension
# Setup with sudo apt-get install -y retroarch "libretro-*""
ROM="${1}"
if [ -z "${ROM}" ];then
echo "Usage: ${0} <ROM_FILE>"
@konsumer
konsumer / MazeMap.lua
Created Mar 17, 2021
example using shironecko/LuaMaze in love2d
View MazeMap.lua
local maze = require "lib.maze"
local Camera = require "lib.hump.camera"
math.randomseed(os.time())
--[[
generators:
sidewinder
recursive_backtracker
aldous_broder
@konsumer
konsumer / generate_renoise.py
Last active Mar 10, 2021
Convert a bunch of wave-files into renoise instruments: I had samples of a drum VST that I recorded by playing all the notes of it, I put all the wave-files in the same dir names "extract_drums_freeze_NAME.wav". This will slice them on silence, and create a drumkit instruments for renoise.
View generate_renoise.py
#!/usr/bin/env python3
from pydub import AudioSegment
from pydub.silence import split_on_silence
from os import listdir, path, rename
from os.path import isfile, join
from pathlib import Path
from shutil import make_archive, rmtree
mapping = {
@konsumer
konsumer / main.rs
Last active Jan 26, 2021
learning rust
View main.rs
#[derive(Debug)]
struct VecStats {
mean: f32,
median: i32,
mode: i32
}
impl VecStats {
fn new(numbers: &Vec<i32>) -> VecStats {
VecStats {
View light_test.cpp
#include <Adafruit_NeoPixel.h>
#define PIN 2 // D4 on nodemcu
#define NUMPIXELS 50
#define DELAYVAL 500
Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_RGB + NEO_KHZ800);
void setup() {
pixels.begin();
@konsumer
konsumer / setup_frida_android.sh
Created Dec 2, 2020
Script to get frida installed on rooted device
View setup_frida_android.sh
#!/usr/bin/env bash
# get frida installed on your android device
# you should be rooted & have adb & unxz in your path
VERSION="14.0.8-android-arm64"
adb shell "su -c killall -9 frida-server"
if ! adb shell "test -f /data/local/tmp/frida-server"; then
View cloudSettings
{"lastUpload":"2021-01-28T08:01:44.280Z","extensionVersion":"v3.4.3"}