Skip to content

Instantly share code, notes, and snippets.

View QuietMisdreavus's full-sized avatar

QuietMisdreavus QuietMisdreavus

View GitHub Profile
@QuietMisdreavus
QuietMisdreavus / status_display_program.sh
Created April 11, 2015 15:04
cmus status display program to start cmusfm if the server process is not already running
#!/bin/sh
pidof cmusfm > /dev/null
if [ $? -ne 0 ]; then
cmusfm status stopped &
fi
cmusfm "$@"
@QuietMisdreavus
QuietMisdreavus / dream.md
Created February 25, 2016 13:58
dream sequence 2016-02-25

a common theme in my dreams is that i'm running away from something, with a fear of being caught by something. the surrounding situation has changed over several years, but it's still a theme that crops up from time to time

today i was running from some kind of oppressive captor, and i had a can of spray paint that was being weird, wouldn't stop spraying while i was releasing pressure, so i throw it out the high window i was already spraying through

this somehow caught some attention and i had to start escaping. i move down the path i came from for a few steps and notice my captors almost at the top of a staircase so i turn around and move into new ground. as i approach another staircase down i see another group and decide to give up and walk arms out toward the group as they appear.

but they're not actually my captors, they're a news team looking for a lottery winner so they can tape a reaction. i move past them, down the stair. as i run through the final stretch, someone tosses me a small item of food. s

@QuietMisdreavus
QuietMisdreavus / colscheme-convert.py
Created May 12, 2016 20:15
python script to convert a Konsole color scheme to a Termite config-style scheme
#!/usr/bin/env python
# colscheme-convert: takes a colorscheme file as based on my Konsole color scheme
# and converts it to something that can be pasted into a termite config file
# Bryan Mitchell ('icesoldier'), May 2016
import sys
import os.path
fname = ''
@QuietMisdreavus
QuietMisdreavus / clean-script.md
Last active July 6, 2016 02:17
small script to clean up my music library folders

a script to clean up my music library folders

i had a simple need: the folders of my music libary have been cluttered with old albums, that had been moved or deleted, but whose folders remained because they still had cover.jpg or AlbumArtSmall.jpg or the like left behind. i wanted these folders gone; they had no use remaining. iTunes would not see these folders (though all of these deletions/moves occurred under iTunes' watch, so you'd think it'd move the images as well *shrug*) so i took matters into my own hands.

this script searches the directory structure, starting in the current working

//i have kv, an iterator over a str.split call, whose next value is the value i'm working on
//in this match arm, i want to take the value and make it an i64
try!(i64::from_str_radix(try!(kv.next().ok_or(error::Error::InvalidResponse)), 10).or(Err(error::Error::InvalidResponse)))
//oh wait, never mind, i need an Option<i64> anyway, and i'll try! it anyway further down, so this is much nicer
kv.next().and_then(|s| i64::from_str_radix(s, 10).ok())
http://bitpuritans.moe/keffie/songs/%21%29%29%C2%A3%5E%25%25%24%5D%5D%27%20%28%23botb%20OHC%20Round%201528%29.mp3
http://bitpuritans.moe/keffie/songs/%23mod_shrine.mp3
http://bitpuritans.moe/keffie/songs/%25filename%25.mp3
http://bitpuritans.moe/keffie/songs/%28%23botb%20OHC%20Round%201406%29.mp3
http://bitpuritans.moe/keffie/songs/%2Co%2CoC%20-%20%21%20%28%60n%C2%B4%20%29%20%28%23botb%20OHC%20Round%201411%29.mp3
http://bitpuritans.moe/keffie/songs/.%20.%20.%20ILLUMINATI%20UR%20GAME%20IS%20T%28H%29RU%20.%20.%20..mp3
http://bitpuritans.moe/keffie/songs/10am%20blaze%20it%20%28%23botb%20OHC%20Round%201290%29.mp3
http://bitpuritans.moe/keffie/songs/12%20bar%20blurps.mp3
http://bitpuritans.moe/keffie/songs/12gen%20toppa%20gurre-legann%20%28%23botb%20OHC%20Round%201065%29.mp3
http://bitpuritans.moe/keffie/songs/2P%20vs.%20Theme%20%28Unfinished%29.mp3
#!/bin/sh
# USAGE: gifsplice.sh [input video file] [output gif file] [output pixel width] [output fps] [start position in seconds] [duration in seconds]
palette="/tmp/palette.png"
filters="fps=$4,scale=$3:-1:flags=lanczos"
ffmpeg -v warning -i $1 -vf "$filters,palettegen" -y $palette
ffmpeg -v warning -i $1 -i $palette -lavfi "$filters [x]; [x][1:v] paletteuse" -y $2
@QuietMisdreavus
QuietMisdreavus / main.rs
Last active September 15, 2016 22:08
rust's regex crate versus twitter-text
//Rust code to compare the regex crate's version of these unicode categories
//to Ruby/Java/Objective-C's versions as collected by Twitter
//https://github.com/twitter/twitter-text/tree/master/unicode_regex
extern crate regex;
fn main() {
let mut decimal = Vec::new();
let mut marks_letters = Vec::new();
@QuietMisdreavus
QuietMisdreavus / what-is-rust.markdown
Created December 29, 2016 21:46
what is rust (baby don't hurt me)

what is rust (baby don't hurt me)

(Hosting in a fake-blog for now until i get back to the computer with the blog files on them >_>)

I've seen a fair amount of discussion recently about what Rust's greatest "selling point" is. This was sparked by Steve Klabink's article about how Rust should be about ["more than safety"][safety]. There have been responses about how the community is top-notch, or how the titular safety allows people to feel empowered to write lower-level software than they had previously thought they were capable of. I'm going to add more words to the pile about a somewhat related point.

@QuietMisdreavus
QuietMisdreavus / rate_limit.json
Created February 23, 2017 18:46
a dump of twitter's rate_limit_info response
{
"rate_limit_context": {
"access_token": "2977334326-MojrQe5K893ReqNKHqXRFm7vWI6VXZKEbf3Fy5U"
},
"resources": {
"account": {
"/account/login_verification_enrollment": {
"limit": 15,
"remaining": 15,
"reset": 1487875992