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 / 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 / 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}" )
#!/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 / 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
@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 / netpbmto.py
Last active August 28, 2020 21:39
netpbmto.py
#!/usr/bin/env python3
#
# show conversions for a (custom built) netpbm
#
# ex: ./netpbmto.py | egrep "\['png'.*'xpm'\]"
#
from os import walk
import re
@ryanwoodsmall
ryanwoodsmall / 32-64-dockerfile
Created February 6, 2020 20:43
32-64-dockerfile
FROM i386/centos:7
#FROM centos:7
RUN \
uname -m | sed 's/^/buildhost: /g' \
&& echo '#!/bin/bash' > /entrypoint.sh \
&& if $(bash -c 'set | grep ^HOSTTYPE= | cut -f2 -d=' | grep -q '86$') ; then \
echo 'this is x86' \
&& echo 'linux32 "${@}"' >> /entrypoint.sh ; \
else \
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
char* findbin(char* s);
char* findbin(char* s)
{
char* p = getenv("PATH");
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
char *findbin(char *b);
int main(int argc, char **argv, char **envp)
{
char *s = "dash";
@ryanwoodsmall
ryanwoodsmall / jenkins-bitbucket_docker-compose.yml
Created April 9, 2020 04:04
jenkins-bitbucket_docker-compose.yml
version: "3"
services:
jenkins:
image: jenkins/jenkins:lts
restart: always
ports:
- "18080:8080"
volumes:
- jenkins:/var/jenkins_home
bitbucket: