Skip to content

Instantly share code, notes, and snippets.

@rmrfus
rmrfus / results.txt
Created May 17, 2022 05:00
list_vs_set
List:
... 49535us
... 48208us
... 48285us
... 48101us
... 48583us
... 47887us
... 47908us
... 47991us
... 48314us
@rmrfus
rmrfus / gruvbox_tty.sh
Last active November 7, 2021 02:33
gruvbox linux terminal
#!/usr/bin/env bash
if [ "$TERM" = "linux" ]; then
echo -en "\e]P01D2021" #black
echo -en "\e]P8928374" #darkgrey
echo -en "\e]P1CC241d" #darkred
echo -en "\e]P9FB4934" #red
echo -en "\e]P298971A" #darkgreen
echo -en "\e]PAB8BB26" #green
echo -en "\e]P3D79921" #brown
@rmrfus
rmrfus / main.j2
Last active July 31, 2021 03:12
WtForms Demo
<form method="POST" action="/">
{% if form.errors %}
<div>
<ul class="errors">
{% for field_name, field_errors in form.errors|dictsort if field_errors %}
{% for error in field_errors %}
<li>{{ form[field_name].label }}: {{ error }}</li>
{% endfor %}
{% endfor %}
</ul>
@rmrfus
rmrfus / sslcert.sh
Created August 10, 2019 19:55
Self-signed certificate oneliner
openssl req -new -newkey rsa:2048 -days 3650 -nodes -x509 -keyout snakeoil.key -out snakeoil.crt
@rmrfus
rmrfus / round_to_prime.py
Last active August 2, 2017 12:57
Generates a random integer and rounds it to the nearest prime number
#!/usr/bin/env python
import sys, os
from random import randint
from cPickle import dump,load
REUSE_FILE="round_to_prime.data"
MAX_VALUE = 1000
@rmrfus
rmrfus / diffdog
Created February 18, 2013 22:10
Simplest monitoring script
#!/bin/sh
umask 027
BASEDIR=/opt/diffdog
WORKERS_DIR=$BASEDIR/workers
RESULTS_BASEDIR=$BASEDIR/results
RECIPIENT="superuser@command.center"
find $WORKERS_DIR -maxdepth 1 -type f -perm -u+rx | while read SCRIPT ; do