Skip to content

Instantly share code, notes, and snippets.

@parke
parke / curev.py
Last active January 1, 2016 19:19
curev.py is a curses event monitor/dumper. It is similar to xev for X11/Xwindows, except it runs in a terminal. I use curev.py to examine what escape sequences various keys generate across various terminals.
import collections, curses, threading
event = threading.Event ()
keys = collections.deque ()
run = threading.Event ()
def reduce ( keys ):
t = []
for n in keys :
if n == 0 : t.append ( '^@' )
@parke
parke / color.lua
Last active April 24, 2022 07:01
Xterm color chart generator
local reset = '\027(B\027[m'
function cellx ( prefix_core, text ) ----------------------------- cellx
io .write ( reset )
io .write ( ('\27[%sm') : format ( prefix_core ) )
io .write ( text )
io .write ( reset ) end
@parke
parke / chart.html
Created May 22, 2020 00:59
Chart JS
<!doctype html>
<html>
<head>
<title>Line Chart</title>
<script
src="https://cdn.jsdelivr.net/npm/[email protected]/dist/Chart.min.js"
></script>
@parke
parke / flatpak-demo.sh
Last active June 16, 2021 19:21
flatpak.sh is a demo that shows how to install and run Flatpak packages inside of an Alpine Linux guest userland inside Lxroot.
#! /bin/dash
# version 20210616
# flatpak.sh is a demo that shows how to install and run Flatpak
# packages inside of an Alpine Linux guest userland inside Lxroot.
@parke
parke / dice.py
Last active October 24, 2022 23:12
Calculate the distribution of outcomes when rolling multiple dice.
#! /usr/bin/python3
# This script will calculate the distribution of rolling any number
# of mixed-sided dice.
# Example usage: python3 dice.py 3d6 1d20
#
# The above would calculate the distribution of rolling four dice