This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- prevent noisy loading of psqlrc file | |
\set QUIET yes | |
--customize prompt | |
\set PROMPT1 '\n%[%033[1;31m%]➤ %[%033[2;37m%]%`\! date "+%F %I:%M %p %Z"`%[%033[0m%] %[%033[1;36m%]%n%@%/%[%033[1;31m%]%x %[%033[K%]%[%033[0m%]\n%[%033[1;33m%]%R%#%[%033[0m%] ' | |
\set PROMPT2 '%[%033[1;33m%]%R%#%[%033[0m%] ' | |
--show timing info for queries | |
\timing | |
-- allow pasting of values to avoid stupid indenting | |
\set paste | |
--get rid of duplicates in history |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; HACK: Teach SLIME about jumping to FiveAM fixture definitions ;; | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
(require 'sb-introspect) | |
(ql:quickload :swank) | |
(ql:quickload :fiveam) | |
;; Poor man's defadvice - stolen from https://gist.github.com/spacebat/46740966846623148c014ab261050bc0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;;;;;;;;;;;; | |
;; Paredit ;; | |
;;;;;;;;;;;;; | |
(use-package paredit | |
:ensure t | |
:init | |
:config | |
(show-paren-mode t) | |
;; Workaround for superfluous spaces inserted in e.g. pathnames, as |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{- | |
**************************** IMPORTANT **************************** | |
This week is a two-step homework. First, you have to solve the | |
"Maze" challenge, and then the "Forest" challenge. The challenges | |
are in two separate files in both the homework and solution, so | |
you can check the solution for the first "Maze" challenge without | |
spoilers of the "Forest" one. Make sure to check the solution for | |
"Maze" (and only "Maze," I see you 🥸👀) before starting with the |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add debugging outputs to requests | |
try: | |
import http.client as http_client | |
except ImportError: | |
# Python 2 | |
import httplib as http_client | |
http_client.HTTPConnection.debuglevel = 1 | |
# You must initialize logging, otherwise you'll not see debug output. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(in-package :lem-core) | |
(defun undefine-key (keymap keyspec) | |
"Remove binding for KEYSPEC from KEYMAP. Two cases for KEYSPEC are | |
considered. If it's a symbol, try to remove the corresponding binding | |
from KEYMAP's FUNCTION-TABLE. If it's a string, parse the string into | |
chained components, try to extract the innermost chained hash table | |
from KEYMAP's TABLE and remove the relevant entry." | |
(check-type keyspec (or symbol string)) | |
(typecase keyspec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from cryptography import x509 | |
from cryptography.hazmat.backends import default_backend | |
from cryptography.hazmat.primitives import hashes | |
from cryptography.hazmat.primitives import serialization | |
import os | |
# Read cert from file | |
with open("cert.pem", "rb") as f: | |
cert= x509.load_pem_x509_certificate(f.read(), default_backend()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Completion functionality a'la Emacs' dabbrev-expand | |
zstyle ':completion:history-words:*' list no | |
zstyle ':completion:history-words:*' remove_all_dups yes | |
zstyle ':completion:history-words:*' stop yes | |
zstyle ':completion:history-words:*' menu yes | |
bindkey "^[/" _history-complete-older |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun factorial-y-combinator (n) | |
(funcall | |
(Y (lambda (f n) | |
(if (zerop n) | |
1 | |
(* n (funcall f f (1- n)))))) | |
n)) | |
(defun tail-factorial-y-combinator (n) | |
(funcall |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; -*-lisp-*- | |
(ql:quickload :legit) | |
(defun sync-utils () | |
(let* ((repo (make-instance 'legit:repository | |
:location "/home/wsg/hack/lisp/util-gist/")) | |
(remote "git@gist.github.com:9323a1b03108d4ff10570c26a21425c1.git")) | |
(legit:init repo :if-does-not-exist :clone :remote remote) | |
(legit:pull repo) |
NewerOlder