Skip to content

Instantly share code, notes, and snippets.

View konsumer's full-sized avatar

David Konsumer konsumer

View GitHub Profile
@konsumer
konsumer / main.rs
Last active July 14, 2022 18:13
learning rust
#[derive(Debug)]
struct VecStats {
mean: f32,
median: i32,
mode: i32
}
impl VecStats {
fn new(numbers: &Vec<i32>) -> VecStats {
VecStats {

Building raylib app in docker (on another computer) for ArkOS RG351V

I am using a mac M1 (arm64), so I didn't need binfmt-support/qemu-user-static installed.

docker run --platform="linux/arm64/v8" -it --rm -v $(pwd):/workdir -w /workdir ubuntu:eoan bash

cat << EOF > /etc/apt/sources.list
deb http://old-releases.ubuntu.com/ubuntu eoan main universe
deb http://old-releases.ubuntu.com/ubuntu eoan-updates main universe
@konsumer
konsumer / LoremGibson.js
Last active March 18, 2022 05:33
A react component that outputs futuristic demo text
import { Fragment, useMemo } from 'react'
const gibson = "nodality,nodal point,jeans,Kowloon,Shibuya,digital,hacker,post-,futurity,papier-mache,rifle,otaku,pistol,modem,uplink,ablative,semiotics,free-market,narrative,pre-,meta-,marketing,8-bit,cyber-,electro-,meta-,cardboard,bicycle,range-rover,city,network,realism,euro-pop,j-pop,Chiba,Tokyo,San Francisco,franchise,sprawl,urban,decay,monofilament,katana,tanto,math-,bomb,grenade,tiger-team,3D-printed,plastic,carbon,nano-,tube,geodesic,dome,construct,A.I.,media,drone,sentient,dolphin,neural,artisanal,beef noodles,wonton soup,hotdog,DIY,Legba,systema,systemic,military-grade,denim,saturation point,order-flow,soul-delay,long-chain hydrocarbons,assault,sensory,stimulate,sub-orbital,BASE jump,youtube,footage,paranoid,apophenia,spook,industrial grade,silent,engine,RAF,wristwatch,shoes,faded,concrete,singularity,stellar,system,galaxy,warp,kanji,refrigerator,computer,render-farm,bridge,disposable,assassin,camera,garage,warehouse,fluidity,towards,into,motion,claymore,f
@konsumer
konsumer / wrap_ladspa.py
Last active January 30, 2022 12:20
You will need `ladspa-sdk` package and make sure `listplugins` is in your path and works.
#!/usr/bin/env python
from subprocess import check_output
import re
import pprint
pp = pprint.PrettyPrinter(indent=2)
plugins=[]
@konsumer
konsumer / btoa.js
Last active January 29, 2022 03:01
Node implementation for btoa/atob to do base64 like in the browser/cloudflare-worker.
if (typeof atob === 'undefined') {
var atob = a => new Buffer(a).toString('base64')
}
if (typeof btoa === 'undefined') {
var btoa = a => Buffer.from(a, 'base64').toString('utf8')
}
@konsumer
konsumer / lspci_osx.js
Created February 11, 2019 23:34
An OSX parser for `ioreg` that will get you vendor/device ID and name of devices on PCI bus
const { spawn } = require('child_process')
const Xml = require('xml-stream')
const fetch = require('node-fetch')
const cheerio = require('cheerio')
// apple returns IDs in funny order
const unmangleID = string => {
if (string) {
const s = string.split('').slice(0, 4)
return `${s[2]}${s[3]}${s[0]}${s[1]}`
@konsumer
konsumer / .colors.sh
Created June 4, 2014 22:59
My setup for pretty colored git-oriented BASH prompt, looks like this with colors: konsumer@Davids-Mac-Pro ~/project (master) $
# Reset
Color_Off="\[\033[0m\]" # Text Reset
# Regular Colors
Black="\[\033[0;30m\]" # Black
Red="\[\033[0;31m\]" # Red
Green="\[\033[0;32m\]" # Green
Yellow="\[\033[0;33m\]" # Yellow
Blue="\[\033[0;34m\]" # Blue
Purple="\[\033[0;35m\]" # Purple
# Reset
Color_Off="\[\033[0m\]" # Text Reset
# Regular Colors
Black="\[\033[0;30m\]" # Black
Red="\[\033[0;31m\]" # Red
Green="\[\033[0;32m\]" # Green
Yellow="\[\033[0;33m\]" # Yellow
Blue="\[\033[0;34m\]" # Blue
Purple="\[\033[0;35m\]" # Purple
@konsumer
konsumer / docker-compose.yml
Last active January 8, 2022 16:35
Setup a quick postres-based GraphQL server, that structures graphs on postgres structure.
# Setup a quick postres-based GraphQL server, that structures graphs on postgres structure.
# run docker-compose up
# postgres admin at http://localhost:8080 (postgres/postgres)
# graphql at http://localhost:5000/graphiql
# change your tables in admin, and the structure will be reflected in graphql
version: '3.1'
services:
db:
@konsumer
konsumer / fixvideo.sh
Created April 28, 2019 01:54
Convert all mkv files to mp4 with non-transcoding codec (for plex) and strip all non-english audio tracks
function fixvideo () {
ffmpeg -i "${1}" -map 0:m:language:eng -vcodec libx264 -acodec aac -sn "$(basename "${1}" "${2}").mp4"
}
for i in *.mkv;do
fixvideo "${i}" ".mkv"
done