Skip to content

Instantly share code, notes, and snippets.

-module(choir).
-export([start/0, start_world/0, say/1, say/3]).
start() -> register(?MODULE, spawn(fun loop/0)).
loop() ->
receive {Message, Voice} ->
os:cmd(io_lib:format("say -v '~s' '~s'", [Voice, Message])),
loop()
end.
@lukateras
lukateras / fizzbuzz.c
Last active November 29, 2021 01:24
Overengineered fizzbuzz in C
#include <stdio.h>
#include <string.h>
#define BUFLEN 9
int main() {
char buf[BUFLEN];
FILE *stream = fmemopen(&buf, BUFLEN, "w");
if (stream == NULL) {
@lukateras
lukateras / hq9+.rb
Last active January 29, 2019 16:57
@accumulator = 0
@beer = ''; 97.times do |n|
@beer << "
#{99-n} bottles of beer on the wall,
#{99-n} bottles of beer.
Take one down and pass it around,
#{98-n} bottles of beer on the wall.
"
end; @beer << "
2 bottles of beer on the wall,
diff -r 59f916c737be keydb.ml
--- a/keydb.ml Tue Oct 23 00:56:31 2018 +0000
+++ b/keydb.ml Tue Jan 22 14:09:31 2019 +0300
@@ -1166,6 +1166,12 @@
try
if has_hash hash then [] else
let keyid = Fingerprint.keyid_from_key ~short:true key in
+ let keyid_long = Fingerprint.keyid_to_string ~short:false (Fingerprint.keyid_from_key ~short:false key) in
+ plerror 4 "considering keyid %s" keyid_long;
+ if List.mem keyid_long [
@lukateras
lukateras / cljack-in
Last active February 1, 2019 07:57
Project-independent nREPL setup for Clojure CLI
#!/bin/sh
exec clj -Sdeps '{:deps {cider/cider-nrepl {:mvn/version "0.20.0"}}}' \
-e '(require `cider-nrepl.main)
(cider-nrepl.main/init ["cider.nrepl/cider-middleware"])'
#include <iostream>
#include <string>
using namespace std;
unsigned int hashLength32(string hash) {
return (hash.length() * 8 - 1) / 5 + 1;
}
// omitted: E O U T
@lukateras
lukateras / fill_the_pool.sh
Last active December 13, 2020 16:38
Redacted SKS exploit that was sent to me by attacker behind https://news.ycombinator.com/item?id=20312826
for _ in {1..500}; do
for _ in {1..100}; do
gpg --gen-key --batch keygen
gpg --quick-sign-key -u Marc EC18257DB21746FC711054BEB19C61D61333360C
rm ~/.gnupg/private-keys-v1.d/*.key
done
rm ~/.gnupg/openpgp-revocs.d/*.rev
gpg -a --export > ~/Desktop/keyblock.asc
{ pkgs ? import ./pkgs.nix {} }:
with pkgs.pkgsStatic;
let
fetchCargo = callPackage <nixpkgs/pkgs/build-support/rust/fetchcargo.nix>;
rustBeta = with buildPackages; rust.packages.stable.overrideScope' (final: previous: {
cargo = (previous.cargo.override {
inherit (rust.packages.stable) rustPlatform;
image: nixos/nix
build:
stage: build
script: nix-build

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted.

The software is provided "as is" and the author disclaims all warranties with regard to this software including all implied warranties of merchantability and fitness. In no event shall the author be liable for any special, direct, indirect, or consequential damages or any damages whatsoever resulting from loss of use, data or profits, whether in an action of contract, negligence or other tortious action, arising out of or in connection with the use or performance of this software.