Skip to content

Instantly share code, notes, and snippets.

@lassik
lassik / version.c
Created May 28, 2019 10:21
Lisp version dumper
#include <sys/wait.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
static const char *args[8];
@lassik
lassik / help-commands.sh
Created July 26, 2018 10:36
Command line options of many code formatters
#!/bin/sh
echo ==============================================================================
clang-format -help
echo ==============================================================================
dfmt --help
echo ==============================================================================
elm-format --help
echo ==============================================================================
gofmt -h
echo ==============================================================================
@lassik
lassik / gist:50e41451f859c20b9b53e2243c02e2db
Created March 30, 2018 14:45
Review of "webhere" programs on github
https://github.com/teerl/httphere
Go. HTTPS, directory listing.
https://github.com/dcparker/httphere
Ruby. HTTPS, cache size, Markdown, Textile.
https://github.com/dgl/httphere
import argparse
from collections import defaultdict
TRUCK_WEIGHT = 8
def ints(line):
return tuple(map(int, line.split()))
def parse(stream):
lines = list(map(ints, stream))
@lassik
lassik / check-locales.rb
Created February 24, 2016 20:14
Basic sanity check for Discourse plugin language translations.
#!/usr/bin/env ruby
#
# Basic sanity check for Discourse plugin language translations.
require "psych"
def keypaths(tree, prefix="")
return [prefix] unless tree.is_a?(Hash)
return tree.map{|k,v| keypaths(v, prefix+"/"+k)}.flatten
end