Skip to content

Instantly share code, notes, and snippets.

View queertypes's full-sized avatar

Allele Dev queertypes

  • Georgia, USA
View GitHub Profile
@queertypes
queertypes / pwgen.sh
Created October 3, 2018 17:43
A simple CLI password generator built on /dev/urandom and Unix tools
#!/bin/bash
# A simple password generator that uses a combination of /dev/urandom,
# tr, head, and xclip to quickly generate a reasonably random password
## strict bash mode
set -euo pipefail
IFS=$'\n\t'
## pwgen [count] [allowed-symbols]
@queertypes
queertypes / playlist-play.sh
Last active March 6, 2018 23:31
Read a playlist from a file using bash, while keeping input-priority for player
#!/bin/bash
# Read the playlist in a line at-a-time from the 4th file descriptor.
# This preserves stdin for mpv below, so mpv can still receive
# keyboard commands.
while read -r -u 4 songPath; do
duration=$(
ffmpeg -i "$songPath" |& ## use ffmpeg in info mode
grep Duration | ## use `cut` to parse the song duration
cut -d, -f 1 | ## "Duration: 00:02:21.234"
@queertypes
queertypes / poe-filter-mode.el
Created December 8, 2017 03:10
emacs minor-mode (syntax highlighting) for Path of Exile item filter files
;;; poe-filter-mode --- a path of exile filter file mode
;;; Commentary:
;;; not much to say
;;; Code:
;; forward declare some vars
(defvar poe-filter-font-lock nil "Font faces for filter files")
(defvar poe-filter-mode-syntax-table nil "Syntax for filter files")
@queertypes
queertypes / gene_extraction.sql
Created September 5, 2017 18:32
Starbound, Frackin' Universe: Gene Extraction SQL
create type gene as enum (
'adaptive_cells',
'agility',
'aquatic_celerity',
'aquatic_homeostasis',
'assimilation',
'avian',
'bioluminescent',
'chloroplast_boost',
'corrosive',
@queertypes
queertypes / .ghci
Created April 24, 2017 17:30
Allele's .ghci
-- my prelude
:set -XNoImplicitPrelude
import Prelude ((++), return, ($))
import YNotPrelude
-- syntax
:set -XBinaryLiterals
:set -XLambdaCase
:set -XTupleSections
:set -XNegativeLiterals
@queertypes
queertypes / 000_init.sql
Created March 3, 2017 18:29
Haskell and Terraria, with opaleye and psql.
create extension "uuid-ossp";
create type herb as enum (
'daybloom',
'moonglow',
'blinkroot',
'waterleaf',
'deathweed',
'shiverthorn',
'fireblossom'
@queertypes
queertypes / .psqlrc.sql
Last active February 12, 2017 22:47
Allele's psqlrc
-- make psql really quiet while the next several commands are processed
\set QUIET 1
-- a colorful prompt that displays, in order:
-- * hostname (green)
-- * port number (yellow)
-- * user (blue)
-- * database (purple)
-- in the format: host:port user@db#
\set PROMPT1 '%[%033[1;32m%]%M:%[%033[1;33m%]%> %[%033[1;34m%]%n@%[%033[1;35m%]%/%R%[%033[0m%]%# '
@queertypes
queertypes / new-gplv3-full-project.hsfiles
Created January 8, 2017 21:58
Haskell Stack template: GPL-3, doctests, hlint, many other goodies
{-# START_FILE {{name}}.cabal #-}
name: {{name}}
version: 0.1.0.0
synopsis: Initial project template from stack
description: Please see README.md
license: GPL-3
license-file: LICENSE
author: {{author-name}}{{^author-name}}Author name here{{/author-name}}
maintainer: {{author-email}}{{^author-email}}[email protected]{{/author-email}}
copyright: {{copyright}}{{^copyright}}{{year}}{{^year}}2017{{/year}} {{author-name}}{{^author-name}}Author name here{{/author-name}}{{/copyright}}
@queertypes
queertypes / Spreadsheet.hs
Created September 30, 2016 21:30
A quick mock-up of a spreadsheet program's structure - because why not
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE GADTs #-}
module Spreadsheet where
import Data.Text
import Data.Word
import Data.Vector
newtype Row = Row Word32
newtype Col = Col Word32
@queertypes
queertypes / Json.hs
Created May 14, 2016 04:53
JSON data model in Haskell (mostly from scratch) with a compact printing function
{-# LANGUAGE OverloadedStrings #-}
module Json (
Value,
-- core API
true, false, nil, number, text, array, object,
-- utils and demo
objects, (.:), jprint, run
) where
import Data.Monoid