This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 "[email protected]:9323a1b03108d4ff10570c26a21425c1.git")) | |
(legit:init repo :if-does-not-exist :clone :remote remote) | |
(legit:pull repo) |
This file contains hidden or 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-*- | |
(defmacro accum (accfn &body body) | |
(let ((ghead (gensym "head")) | |
(gtail (gensym "tail")) | |
(garg (gensym "arg"))) | |
`(let* ((,ghead (list nil)) | |
(,gtail ,ghead)) | |
(macrolet ((,accfn (,garg) | |
`(setf ,',gtail |
This file contains hidden or 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
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE DeriveGeneric #-} | |
{-# LANGUAGE TypeOperators #-} | |
{-# LANGUAGE DuplicateRecordFields #-} | |
{-# LANGUAGE NamedFieldPuns #-} | |
module TelegramMessage where | |
import Data.Aeson | |
import Data.Proxy |
This file contains hidden or 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 decimal-to-ip (decimal) | |
"Retrieve IP address by first obtaining a binary representation, | |
grouping it into 4 octets and finally reassembling them as 4 decimal | |
numbers." | |
(apply #'format nil "~a.~a.~a.~a" | |
(mapcar #'(lambda (s) (parse-integer s :radix 2)) | |
(cl-ppcre:all-matches-as-strings "[01]{8}" (format nil "~2r" decimal))))) | |
(defun decimal-to-ip-bitwise (decimal) | |
"Convert numerical representation to octet-based IP via the byte |
This file contains hidden or 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
"https://learnvimscriptthehardway.stevelosh.com/chapters/36.html | |
function FB(n) | |
let s = "" | |
if a:n % 3 == 0 | |
let s = s . "Fizz" | |
endif | |
if a:n % 5 == 0 | |
let s = s . "Buzz" | |
endif |
This file contains hidden or 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
... | |
dependencies: | |
- base >= 4.7 && < 5 | |
- mtl | |
- aeson | |
- servant | |
- http-client | |
- http-client-tls | |
- servant-client | |
... |