Skip to content

Instantly share code, notes, and snippets.

@cdosborn
cdosborn / gist:a4b4dc8175c4634edbfb
Last active February 21, 2016 19:41
Make suckless st compile on OSX..
diff --git a/config.mk b/config.mk
index 81e3e47..8f2352a 100644
--- a/config.mk
+++ b/config.mk
@@ -14,7 +14,7 @@ X11LIB = /usr/X11R6/lib
INCS = -I. -I/usr/include -I${X11INC} \
`pkg-config --cflags fontconfig` \
`pkg-config --cflags freetype2`
-LIBS = -L/usr/lib -lc -L${X11LIB} -lm -lrt -lX11 -lutil -lXft \
+LIBS = -L/usr/lib -lc -L${X11LIB} -lm -lX11 -lutil -lXft \
@cdosborn
cdosborn / searcher.ts
Last active February 5, 2024 18:38 — forked from sod/giganticString.js
A modified interface to the SOD search algorithm ;)
import escapeStringRegexp from "escape-string-regexp";
import bs from "binary-search";
// interface SearchFunc<T> {
// (needle?: string, maxResults: number): T[]
// }
// search = searcher(d => [d.name, d.age], [{name:"a", age:4}, ...])
// search("4") -> {name:"a", age:4}
const searcher = <T>(
@cdosborn
cdosborn / verify_sns.py
Last active October 5, 2023 22:31 — forked from amertkara/aws_utils.py
Amazon SNS Notification Verification with Python, M2Crypto. When the SNS pushes a notification, a receiver should verify the origin/integrity of the push notification (AWS) using the signature and certificate provided in the notification data. The function `verify_sns_notification` below takes the request object and verifies the origin/integrity…
from flask import current_app
from cryptography import x509
from cryptography.exceptions import InvalidSignature
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.asymmetric import rsa
from cryptography.hazmat.primitives.asymmetric import padding
import base64
from urllib.parse import urlparse
import logging