Skip to content

Instantly share code, notes, and snippets.

View unhammer's full-sized avatar
kevin :: Coffee → Code

Kevin Brubeck Unhammer unhammer

kevin :: Coffee → Code
View GitHub Profile
@rjhansen
rjhansen / keyservers.md
Last active April 14, 2024 12:28
SKS Keyserver Network Under Attack

SKS Keyserver Network Under Attack

This work is released under a Creative Commons Attribution-NoDerivatives 4.0 International License.

Terminological Note

"OpenPGP" refers to the OpenPGP protocol, in much the same way that HTML refers to the protocol that specifies how to write a web page. "GnuPG", "SequoiaPGP", "OpenPGP.js", and others are implementations of the OpenPGP protocol in the same way that Mozilla Firefox, Google Chromium, and Microsoft Edge refer to software packages that process HTML data.

Who am I?

@vshabanov
vshabanov / OneBRC.hs
Last active March 21, 2024 22:19
One billion lines challenge
{-# LANGUAGE GHC2021, LambdaCase, PatternSynonyms, RecordWildCards,
ViewPatterns, OverloadedStrings, GADTs, NoMonoLocalBinds,
UnboxedTuples, MagicHash #-}
{-# OPTIONS_GHC -O2 -fspec-constr-count=100 -fllvm #-}
-- need at least 8 to completely remove all allocations
-- (I don't know what change lead to it)
{-# OPTIONS_GHC -Wall -Wno-gadt-mono-local-binds -Wno-type-defaults #-}
@ttesmer
ttesmer / AD.hs
Last active March 19, 2024 03:04
Automatic Differentiation in 38 lines of Haskell using Operator Overloading and Dual Numbers. Inspired by conal.net/papers/beautiful-differentiation
{-# LANGUAGE TypeSynonymInstances #-}
data Dual d = D Float d deriving Show
type Float' = Float
diff :: (Dual Float' -> Dual Float') -> Float -> Float'
diff f x = y'
where D y y' = f (D x 1)
class VectorSpace v where
zero :: v
@mtolly
mtolly / Adder.hs
Created July 29, 2015 01:22
Small example of compiling a Haskell Mac .dylib to be used from C
{-# LANGUAGE ForeignFunctionInterface #-}
module Adder where
import Foreign.C
adder :: CInt -> CInt -> IO CInt
adder x y = return $ x + y
foreign export ccall adder :: CInt -> CInt -> IO CInt
@poliveira89
poliveira89 / gist:5966434
Created July 10, 2013 13:51
How to use WebDav on Linux+XFCE+Thunar
davs://poliveira@some.webserver.pt/webdav/someFolder
@Arnavion
Arnavion / ip-flash.awk
Created November 18, 2019 19:34
Flash Raspberry Pi's IP address using its LED
#!/usr/bin/awk -f
BEGIN {
while (1) {
split(exec_line_match("ip addr show dev eth0", " inet "), ip_a_parts, " ")
split(ip_a_parts[2], ip_value_parts, "/")
split(ip_value_parts[1], ip_parts, ".")
reset();
@unhammer
unhammer / merlin-init.sh
Last active February 12, 2023 05:40
Create .merlin file for a project with all your ocamlfind packages and .opam sources in there
#!/bin/sh
if test -f .merlin; then
echo ".merlin already exists, bailing out ..." >&2
exit 1
else
# You could add your default EXT's and such to this list:
@moyix
moyix / arith1000_t0.1_k0_p0.0_results.txt
Created February 10, 2022 21:52
Data files for GPT-NeoX-20B arithmetic (100 and 1000 questions)
Question Real Guess Correct? RelErr Digits
What is 18857 - 592? 18265 18265 Yes 0.0% 5/5
What is 30752 - 3087? 27665 27365 No 1.1% 4/5
What is 2241 + 19873? 22114 22114 Yes 0.0% 5/5
What is 5412 + 10169? 15581 15581 Yes 0.0% 5/5
What is 11831 - 9178? 2653 3153 No 18.8% 2/4
What is 1701 * 19933? 33906033 33953373 No 0.1% 4/8
What is 11648 + 17851? 29499 30509 No 3.4% 1/5
What is 29253 - 6202? 23051 22151 No 3.9% 3/5
What is 27365 + 24989? 52354 53554 No 2.3% 3/5
@1stvamp
1stvamp / mac-curl-ca-bundle.sh
Created March 22, 2012 12:50
Script to install cURL CA certificates on OS X without macports
#!/bin/bash
mkdir /tmp/curl-ca-bundle
cd /tmp/curl-ca-bundle
wget http://curl.haxx.se/download/curl-7.22.0.tar.bz2
tar xzf curl-7.22.0.tar.bz2
cd curl-7.22.0/lib/
./mk-ca-bundle.pl
if [ ! -d /usr/share/curl/ ]; then
sudo mkdir -p /usr/share/curl/
else
@tavisrudd
tavisrudd / readline_clipboard.sh
Created August 24, 2011 20:18
bash readline integration with clipboards: M-k = kill, M-y = yank, M-u = backwards kill
## derived from http://stackoverflow.com/questions/994563/integrate-readlines-kill-ring-and-the-x11-clipboard
## You need to choose which clipboard to integrate with, OS X or X11:
shell_copy() {
pbcopy # OS X
# or ssh user@remote_mac pbcopy
# or xclip
}
shell_yank() {