Skip to content

Instantly share code, notes, and snippets.

Avatar

Coder of Salvation / Leon van Kammen coderofsalvation

View GitHub Profile
@coderofsalvation
coderofsalvation / opendirectory.lua
Last active Nov 7, 2022
open directory for redbean / rclone
View opendirectory.lua
-- Open directory viewer (like apache opendir, based on unix.opendir example)
--
-- Usage:
-- function OnHttpRequest()
-- if( not dir.serve() ) then
-- print("default")
-- Route()
-- end
-- end
--
View python-patterns.md

Useful Python Patterns/Functions NOTE: for 3D or lua JS patterns see my other patterns-gists 3D patterns-page

easy debugging/printing using pdb

import pdb

# somewhere in your code
pdb_settrace()
@coderofsalvation
coderofsalvation / comingsoon.md
Last active Oct 29, 2022
wrk.ist coming back soon
View comingsoon.md

db d8b db d8888b. db dD d888888b .d8888. d888888b 88 I8I 88 88 8D 88 ,8P' 88' 88' YP ~~88~~' 88 I8I 88 88oobY' 88,8P 88 8bo. 88
Y8 I8I 88 888b 888b 88 Y8b. 88 8b d8'8b d8' 88 88. 88 88. db .88. db 8D 88
8b8' 8d8' 88 YD YP YD VP Y888888P `8888Y' YP

@coderofsalvation
coderofsalvation / notes.md
Created Oct 7, 2022
using iptables to redirect low ports to high ports with rootless podman containers
View notes.md

IPTABLES

server $ proxyport(){
        iptables -t nat -A PREROUTING -p tcp --dport $1 -j REDIRECT --to-port $2
        iptables -t nat -I OUTPUT -p tcp -d 127.0.0.1 --dport $1 -j REDIRECT --to-ports $2
  }
server $ proxyport 80 8080
server $ proxyport 81 8181
server $ proxyport 443 4443
@coderofsalvation
coderofsalvation / howto rootless podman container connecting to REST api docker.sock.md.md
Last active Oct 11, 2022
howto rootless podman container connecting to REST api /var/run/docker.sock
View howto rootless podman container connecting to REST api docker.sock.md.md

Ok I was struggling a bit finding info about this. In a nutshell:

  • /var/run/docker.sock only works for root(ful) containers
  • there's no rootless socket-file created by default (you need to run an API listener service)

STEP 1: run API listener service (to create socketfile)

# whoami
@coderofsalvation
coderofsalvation / AFRAME.utils.throttleTicks.js
Last active Sep 22, 2022
AFRAME.utils.throttleTicks() allows central (throttle)control of all AFRAME components-ticks (without having to patch community components)
View AFRAME.utils.throttleTicks.js
/*
* Usage:
*
* AFRAME.utils.throttleTicks({
* 'aabb-collider':{ "*": 150 },
* 'texturescroll':{ "*": 50 },
* 'foo': { "*": AFRAME.utils.device.isMobile() ? 150 : 50 }
* }, true)
*
*/
@coderofsalvation
coderofsalvation / checksum.sh
Created Sep 12, 2022
generate checksum from directory tree (unix / shell)
View checksum.sh
find . -type f -printf "%p %s\n" | LC_ALL=C sort | md5sum
# output: a71e7b59041f2db45adb105596519167 -
View index.html
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand" href="#">Metaradio</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="#link2" onclick="alert('todo')">About</a></li>
<li><a href="#link3" onclick="alert('todo')">Examples</a></li>
</ul>
@coderofsalvation
coderofsalvation / ASCIISTEP16.md
Last active Nov 19, 2022
ASCIISTEP16 - the pckeyboard standard of 16-step sequencers (RFC)
View ASCIISTEP16.md

Version

v1.0

2022-08-01 draft (Leon van Kammen/coderofsalvation)
2022-09-01 ASCIISTEP16 implemented in milkytracker

What is ASCIISTEP16

@coderofsalvation
coderofsalvation / milkytracker-new-features.md
Last active Aug 30, 2022
new milkytracker features in the making
View milkytracker-new-features.md

laptopfriendly instrument/sample/stepsize/orderlist keyboard navigation

(milkytracker keyboard layout)

extra pasting 'mix'-modes