Skip to content

Instantly share code, notes, and snippets.

Avatar

David Konsumer konsumer

View GitHub Profile
@konsumer
konsumer / Makefile
Created January 27, 2023 23:45
Self-help for a Makefile in a python project
View Makefile
.PHONY: help clean
help: ## Show this help
@python tools/help.py "$(MAKEFILE_LIST)"
clean: ## Remove all built files
@rm -f FILES
@konsumer
konsumer / kali_gpi2.md
Last active October 10, 2022 04:54
Install Kali on GPI2
View kali_gpi2.md
@konsumer
konsumer / Router.js
Created December 4, 2018 01:06
Tiny react router that uses hooks
View Router.js
/**
* My lightweight router using hooks
*/
import React, { cloneElement, useContext, useState, useEffect } from 'react'
import createHistory from 'history/createBrowserHistory'
import Path from 'path-parser'
// for direct import
export const history = createHistory()
View MyCoolForm.jsx
import React form 'react'
import { compose, withHandlers } from 'recompose'
import { formHandler } from './utils'
// usage example
export const MyCoolForm = ({form, setForm, onSubmit}) => (
<form onSubmit={onSubmit}>
<input type="name" value={form.name} onChange={setForm('name')} />
<input type="email" value={form.email} onChange={setForm('email')} />
<input type="password" value={form.password} onChange={setForm('password')} />
@konsumer
konsumer / main.rs
Last active July 14, 2022 18:13
learning rust
View main.rs
#[derive(Debug)]
struct VecStats {
mean: f32,
median: i32,
mode: i32
}
impl VecStats {
fn new(numbers: &Vec<i32>) -> VecStats {
VecStats {
@konsumer
konsumer / setup.sh
Created June 3, 2022 01:01
make a debian-based os image and chroot for arm (run in arm64 qemu)
View setup.sh
#!/bin/bash -e
apt install -y build-essential debootstrap unzip git
# create image
qemu-img create -f qcow2 -o preallocation=metadata rknullos.qcow2 2G
modprobe nbd max_part=8
qemu-nbd --connect=/dev/nbd0 rknullos.qcow2
# paritition
View raylib_arkos.md

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
View LoremGibson.js
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.
View wrap_ladspa.py
#!/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.
View btoa.js
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')
}