Skip to content

Instantly share code, notes, and snippets.

Avatar

Allele Dev queertypes

View GitHub Profile
@queertypes
queertypes / pwgen.sh
Created Oct 3, 2018
A simple CLI password generator built on /dev/urandom and Unix tools
View pwgen.sh
#!/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 Mar 6, 2018
Read a playlist from a file using bash, while keeping input-priority for player
View playlist-play.sh
#!/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 Dec 8, 2017
emacs minor-mode (syntax highlighting) for Path of Exile item filter files
View poe-filter-mode.el
;;; 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 Sep 5, 2017
Starbound, Frackin' Universe: Gene Extraction SQL
View 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 Apr 24, 2017
Allele's .ghci
View .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 Mar 3, 2017
Haskell and Terraria, with opaleye and psql.
View 000_init.sql
create extension "uuid-ossp";
create type herb as enum (
'daybloom',
'moonglow',
'blinkroot',
'waterleaf',
'deathweed',
'shiverthorn',
'fireblossom'
@queertypes
queertypes / .psqlrc.sql
Last active Feb 12, 2017
Allele's psqlrc
View .psqlrc.sql
-- 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 Jan 8, 2017
Haskell Stack template: GPL-3, doctests, hlint, many other goodies
View new-gplv3-full-project.hsfiles
{-# 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}}example@example.com{{/author-email}}
copyright: {{copyright}}{{^copyright}}{{year}}{{^year}}2017{{/year}} {{author-name}}{{^author-name}}Author name here{{/author-name}}{{/copyright}}
@queertypes
queertypes / Spreadsheet.hs
Created Sep 30, 2016
A quick mock-up of a spreadsheet program's structure - because why not
View Spreadsheet.hs
{-# 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
JSON data model in Haskell (mostly from scratch) with a compact printing function
View Json.hs
{-# LANGUAGE OverloadedStrings #-}
module Json (
Value,
-- core API
true, false, nil, number, text, array, object,
-- utils and demo
objects, (.:), jprint, run
) where
import Data.Monoid