Skip to content

Instantly share code, notes, and snippets.

View paulsmith's full-sized avatar
😀
Hi, friends

Paul Smith paulsmith

😀
Hi, friends
View GitHub Profile
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)
diff -u -r c_only/Makefile plugins_darwin/Makefile
--- c_only/Makefile 2012-08-19 22:53:58.000000000 -0400
+++ plugins_darwin/Makefile 2012-08-24 08:00:34.000000000 -0400
@@ -10,7 +10,7 @@
PLUGIN_DIR = plugins
-all: htmlize_main $(PLUGIN_DIR)/tt.so $(PLUGIN_DIR)/narcissist.so
+all: htmlize_main $(PLUGIN_DIR)/tt.dylib $(PLUGIN_DIR)/narcissist.dylib
@paulsmith
paulsmith / uni-ascii-translit.txt
Last active February 15, 2019 19:55
Unicode code points transliterated into ASCII characters (using `iconv(1)`). The code points are the printable (i.e., non-control) characters in the Latin-1 Supplement and Latin Extended-A blocks. The first column is the code point in decimal, then code point in hex, then the Unicode character, finally the ASCII transliterated character(s).
160 U+00a0  
161 U+00a1 ¡ !
162 U+00a2 ¢ c
163 U+00a3 £ lb
165 U+00a5 ¥ yen
166 U+00a6 ¦ |
167 U+00a7 § SS
168 U+00a8 ¨ "
169 U+00a9 © (c)
170 U+00aa ª a
@paulsmith
paulsmith / tcpproxy.go
Created May 10, 2016 17:18
simple TCP forwarder, go run tcpproxy.go
package main
import (
"flag"
"io"
"log"
"net"
)
func main() {
@paulsmith
paulsmith / wopr-scenarios.txt
Created September 29, 2016 18:35
WOPR nuclear war scenarios
U.S. FIRST STRIKE
USSR FIRST STRIKE
NATO / WARSAW PACT
FAR EAST STRATEGY
US USSR ESCALATION
MIDDLE EAST WAR
USSR CHINA ATTACK
INDIA PAKISTAN WAR
MEDITERRANEAN WAR
HONGKONG VARIANT
@paulsmith
paulsmith / utf8decode.c
Created April 25, 2018 14:16
utf-8 decoder
/* 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 February 9, 2018 21:16
Feelings about food (draft blog post)

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 February 7, 2018 01:26
Halal cart-style chickpeas & rice recipe

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 December 5, 2017 21:06
AOC 2017 day 3 part 2
package main
import (
"fmt"
"os"
)
type grid map[complex128]int
func (g grid) neighbors(pos complex128) int {