Skip to content

Instantly share code, notes, and snippets.

Avatar
😀
Hi, friends

Paul Smith paulsmith

😀
Hi, friends
View GitHub Profile
View output.console
paul@pumpkin:/tmp/SQLite-cf538e27$ python3.7 -c 'import sqlite3; print(sqlite3.connect(":memory").execute("select sqlite_version()").fetchone())'
('3.27.2',)
paul@pumpkin:/tmp/SQLite-cf538e27$ ldd /usr/lib/python3.7/lib-dynload/_sqlite3.cpython-37m-x86_64-linux-gnu.so
linux-vdso.so.1 (0x00007ffff752e000)
libsqlite3.so.0 => /usr/lib/x86_64-linux-gnu/libsqlite3.so.0 (0x00007f89e005b000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f89e003a000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f89dfe79000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f89dfcf6000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f89dfcf1000)
/lib64/ld-linux-x86-64.so.2 (0x00007f89e01da000)
View utf8decode.c
/* decodes next unicode code point in utf-8-encoded buffer. returns number of bytes
read so stream can be advanced, -1 if invalid utf-8 sequence. */
size_t decode_next_utf8(const unsigned char *str, size_t len, int *cp)
{
*cp = 0;
if (*str <= 0x7f) {
*cp = (int)*str;
return 1;
} else if (((*str & 0xe0) == 0xc0) && len > 1) {
if ((*(str+1) & 0xc0) != 0x80) {
@paulsmith
paulsmith / food-feelings.md
Created Feb 9, 2018
Feelings about food (draft blog post)
View food-feelings.md

My family attended a Quaker meeting in Frederick, Maryland when I was growing up, and many of its members were closely associated with a food co-op there. We would volunteer to run the register or stock shelves and do other admin jobs. I remember the strange smell of bulk food items like spices and grains mixing together. I remember the "weird" items that were like items you'd get in regular grocery stores, but were weird because instead of chocolate the candy bars were made with carob. I remember that the co-op was a strong component of the identity of the people who worked, volunteered, and shopped there, including the Quakers and my family.

@paulsmith
paulsmith / halal-cart-chickpea-rice-recipe.md
Created Feb 7, 2018
Halal cart-style chickpeas & rice recipe
View halal-cart-chickpea-rice-recipe.md

Adapt this recipe to make it vegetarian and in a rice cooker:

  • Ignore the chicken part (unless you want to make chicken)
  • In a rice cooker (at least 6c), in this order add:
    • Sliced butter (or non-dairy fat)
    • Turmeric and cumin
    • We also add Aleppo pepper and urfa biber for extra seasoning
    • Broth and rice (we use brown), salt and pepper
    • I add a can of chick peas
    • Cook like you would rice (just turn it on)
@paulsmith
paulsmith / day3part2.go
Created Dec 5, 2017
AOC 2017 day 3 part 2
View day3part2.go
package main
import (
"fmt"
"os"
)
type grid map[complex128]int
func (g grid) neighbors(pos complex128) int {
@paulsmith
paulsmith / jazz.md
Last active Sep 11, 2017
jazz for raph
View jazz.md
  • The Necks - long, deeply improvisational "drone" jazz from Australia, start with "Hanging Gardens"
  • John Zorn & Masada - klezmer-influenced, razor-sharp virtuosic sax
  • Miles Davis - later electric period, "On the Corner", "Bitches Brew", also "In a Silent Way" one of my absolute faves
  • Ellington, Roach, Mingus - "Money Jungle", a one-off, so aging Duke could play around with a post-bop trio
  • Andrew Hill - Monk-esque pianist/composer, check out "Point of Departure"
  • John Coltrane - "My Favorite Things", "Giant Steps", and "A Love Supreme", all in the pantheon
  • Steve Reid - "Nova": hard to find but wicked
  • Bill Evans - sublime pianist, anything from him
  • Michael Naura Quartet - vibraphones, "Call": one of my absolute all-time favorite records
  • Don Cherry - trumpeter, "Brown Rice"
@paulsmith
paulsmith / numeronym.el
Created Jul 12, 2017
numeronym minor mode
View numeronym.el
(defun pas-numeronym ()
"Replace last word with its numeronym. eg.: 'accessibility' with 'a11y'."
(interactive)
(save-excursion
(backward-word)
(let ((count 0) (the-word (current-word)))
(while (looking-at "[a-zA-Z']")
(setq count (1+ count))
(forward-char 1))
(if (>= count 4)
@paulsmith
paulsmith / make-precommit.log
Last active Jan 6, 2017
Running `make precommit` on commit 335c7b6863046ecd92bb1e4c384b23e13adf0403
View make-precommit.log
************* Module grumpy.compiler.block
compiler/block.py:443: Unused argument 'unused_node' (unused-argument)
************* Module grumpy.compiler.block_test
compiler/block_test.py:81: Using deprecated method assertRegexpMatches() (deprecated-method)
compiler/block_test.py:83: Using deprecated method assertRegexpMatches() (deprecated-method)
compiler/block_test.py:85: Using deprecated method assertRegexpMatches() (deprecated-method)
compiler/block_test.py:87: Using deprecated method assertRegexpMatches() (deprecated-method)
compiler/block_test.py:89: Using deprecated method assertRegexpMatches() (deprecated-method)
compiler/block_test.py:91: Using deprecated method assertRegexpMatches() (deprecated-method)
compiler/block_test.py:93: Using deprecated method assertRegexpMatches() (deprecated-method)
@paulsmith
paulsmith / README
Last active Dec 2, 2016
day 1 of 2016 advent of code solution, parts 1 & 2
View README
for http://adventofcode.com/2016/day/1
$ # copy day 1 puzzle input to file
$ make day1
$ ./day1 < day1.input
# part 1 output
$ touch day1.c && make CFLAGS=-DPART2 day1
$ ./day1 < day1.input
# part 2 output
You can’t perform that action at this time.