Skip to content

Instantly share code, notes, and snippets.

View ryanwoodsmall's full-sized avatar
🍞
🍞 bread 🍞 sandwich 🍞

ryan ryanwoodsmall

🍞
🍞 bread 🍞 sandwich 🍞
View GitHub Profile
@ryanwoodsmall
ryanwoodsmall / crosware_zip_to_git.sh
Created December 13, 2019 07:12
crosware_zip_to_git.sh
#!/bin/bash
#
# turn a crosware master.zip into a git checkout with jgit
#
cd /usr/local
curl -kLO https://github.com/ryanwoodsmall/crosware/archive/master.zip
unzip -o master.zip
mv crosware-master crosware
@ryanwoodsmall
ryanwoodsmall / etc_xinetd.d_ssh
Last active February 16, 2020 05:22
/etc/xinetd.d/ssh
#ssh stream tcp nowait root /usr/sbin/dropbear dropbear -i -R
# set type = UNLISTED to run on an off port
service ssh
{
socket_type = stream
protocol = tcp
wait = no
port = 22
user = root
#!/bin/bash
echo "max pid is $(cat /proc/sys/kernel/pid_max)"
for i in {1..132000} ; do
if [ $((${i}%1000)) -eq 0 ] ; then
echo "${i} $(realpath /proc/self)"
else
realpath /proc/self >/dev/null 2>&1
fi
done
@ryanwoodsmall
ryanwoodsmall / old_remove_dupes.sh
Last active May 24, 2019 18:42
remove_dupes.sh
# XXX - need to pre-build daa=1 for "set -eu" scripts
function remove_dupes() {
local dstring="${1}"
local dsep="${2}"
local -A daa
local -a du
for dl in $(echo "${dstring}" | tr "${dsep}" "\n") ; do
if [ -z "${daa[${dl}]}" ] ; then
daa["${dl}"]=1
du+=( "${dl}" )
@ryanwoodsmall
ryanwoodsmall / hello_flask.py
Last active May 3, 2019 20:00
hello_flask.py
from flask import Flask
from flask import request
from os import environ
import json
romethods = ['GET', 'HEAD', 'OPTIONS']
rwmethods = ['DELETE', 'POST', 'PUT']
allmethods = romethods + rwmethods
app = Flask(__name__)
environ['FLASK_DEBUG'] = '1'
@ryanwoodsmall
ryanwoodsmall / etc_init.d_rcS
Last active May 2, 2019 18:16
busybox_lxc_files
#!/bin/sh
/bin/test -e /etc/fstab && /bin/mount -a
/bin/test -e /dev/urandom || /bin/mknod -m 666 /dev/urandom c 1 9
/bin/test -e /dev/zero || /bin/mknod -m 666 /dev/zero c 1 5
/bin/test -e /dev/null || /bin/mknod -m 666 /dev/null c 1 3
/bin/syslogd
/bin/ifconfig eth0 0.0.0.0 up
/bin/udhcpc -b -v
@ryanwoodsmall
ryanwoodsmall / esp8266_wifi.py
Last active February 8, 2021 19:53
esp8266 esp32 micropython main.py wifi setup
#!/usr/bin/env python
#
# erase the esp8266 flash
# sudo $(which esptool.py) --port /dev/ttyUSB0 erase_flash
# write the micropython firmware
# sudo $(which esptool.py) --port /dev/ttyUSB0 --baud 460800 write_flash --flash_size=detect -fm dio 0 /tmp/esp8266-20190125-v1.10.bin
# save this file to esp8266_wifi.py
# add your wireless network/password to the wifi.connect() line
# run:
# echo "f=open('/main.py','w')"
@ryanwoodsmall
ryanwoodsmall / loop_an_mp3_with_lame.sh
Created February 16, 2019 08:44
loop_an_mp3_with_lame.sh
#!/bin/bash
for i in {1..7} ; do
echo $i 1>&2
cat the_caretaker-an_empty_bliss_beyond_this_world.mp3
done \
| lame \
--preset standard \
--mp3input \
- \
the_caretaker-an_empty_bliss_beyond_this_world-6hr_loop.mp3
@ryanwoodsmall
ryanwoodsmall / python-readline-tab-completion.py
Last active January 9, 2019 09:43
python-readline-tab-completion.py
# https://stackoverflow.com/questions/246725/how-do-i-add-tab-completion-to-the-python-shell
# https://gist.github.com/twneale/5245670
#
# add to ~/.pythonrc
# set environment:
# export PYTHONSTARTUP="$HOME/.pythonrc"
#
# enable syntax completion
try:
import readline
SOLIPSISTIC ECLIPSE PUBLIC LICENSE
Version 1, NOVEMBER 2014
Copyright (C) 2014
Everyone is permitted to copy and distribute verbatim copies of this license
document. Modified copies of this document are permitted provided that they
denounce BOTH the original AND their copy as mere sense data with no verifiable
cause outside the mind.
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION