Skip to content

Instantly share code, notes, and snippets.

View phred's full-sized avatar
🌴
On vacation

Fred Alger phred

🌴
On vacation
View GitHub Profile
@phred
phred / keybase.md
Created November 18, 2020 04:36
Keybase proof (for 2020 onward)

Keybase proof

I hereby claim:

  • I am phred on github.
  • I am phred (https://keybase.io/phred) on keybase.
  • I have a public key ASCX9eWjSHNg-bBcaiwE1gZpXAkvRvHS9SSY41zmoYcXcgo

To claim this, I am signing this object:

@phred
phred / ghost-export.rkt
Created May 6, 2019 15:33
Exporting posts from a Ghost SQLite database to Pollen https://docs.racket-lang.org/pollen/index.html
#lang racket
(require racket/dict)
(require db)
(define ghost (sqlite3-connect #:database "ghost/content/data/ghost.db"))
(define posts-result
(query ghost "select published_at, slug, title, markdown from posts where status='published'"))
(define posts (rows->dict posts-result #:key "slug" #:value '#("published_at" "title" "markdown")))
// Rebuilding the old fidget interface using hyperapp.js.org (h), replacing the old react
// For comparison, see: https://github.com/phred/fidget/blob/master/index.html#L16-L121
// Nothing's wired up, it's just a text editor that shows you what line you have selected
// and echoes the line's content in a column to the right.
import { h, app } from "hyperapp"
var getCurrentLine = function (node) {
var lineNum = node.value.substr(0, node.selectionStart).split("\n").length - 1;

Emacs

Emacs word completion

Complete in local buffer

M-/ binds to dabbrev-expand, it’s very much like Vim’s insert mode C-n

Hippie expansion

Not enabled by default, tries to complete whatever’s at the point

Emacs

Emacs word completion

Complete in local buffer

M-/ binds to dabbrev-expand, it’s very much like Vim’s insert mode C-n

Hippie expansion

Not enabled by default, tries to complete whatever’s at the point

@phred
phred / adminer.css
Created May 16, 2016 07:53
THIS IS THE GOOD ADMINER THEME FOLKS
/*
FLAT UI Flavored Adminer Theme by M. Mahbubur Rahman (mahbub@mahbubblog.com)
Screenshot : http://d.pr/i/cznH
Based on work by : Lukáš Brandejs
https://raw.github.com/vrana/adminer/master/designs/ng9/adminer.css
*/
@import url(https://fonts.googleapis.com/css?family=Roboto:400,600);
@phred
phred / structured_dump.sh
Created May 16, 2016 07:43
tiny script to dump tables with dependencies / child records in the correct order for later re-insertion
#!/bin/bash
set -eu
export DB=mydb
function dump {
echo '-- mysqldump --compact -t $DB' $@
mysqldump --compact -t $DB $@
@phred
phred / advent.factor
Created May 16, 2016 03:31
Some assorted Advent of Code (http://adventofcode.com/) solutions written in Factor because YOLO 🎉
: sides ( [] -- sides ) {
[ [ first ] [ second ] bi 2array ]
[ [ second ] [ third ] bi 2array ]
[ [ first ] [ third ] bi 2array ]
} cleave 3array ;
: area ( side -- area ) first2 * 2 * ;
: extra ( sides -- extra ) first first2 * ;
: side-area ( side -- area ) first2 * 2 * ;
: total-paper ( dims -- area ) sides [ area ] [ extra ] bi + ;
@phred
phred / Caddyfile
Created March 28, 2016 18:41
A+ grade on securityheaders.io with this: https://securityheaders.io/?q=https%3A%2F%2Ffff.red
fff.red {
header / {
Strict-Transport-Security "max-age=31536000; includeSubDomains"
Content-Security-Policy "default-src https:*"
Public-Key-Pins "pin-sha256=\"ckOIjdimiwD3mfMmkmCh7uiJCBtXvoqoBoKKB1K5UIM=\"; pin-sha256=\"QiTyymM4e635OgWkx9d7nq5xvEuqmgV7HiDjIIGyymo=\"; max-age=2592000"
X-Frame-Options SAMEORIGIN
X-XSS-Protection "1; mode=block"
X-Content-Type-Options nosniff
}
}
@phred
phred / SassMeister-input-HTML.html
Created January 9, 2015 21:39
Generated by SassMeister.com.
<p>zuul</p>