Skip to content

Instantly share code, notes, and snippets.

@hwayne
hwayne / etl.als
Created June 26, 2023 20:38
Simple ETL pipeline in Alloy
// ETL pipeline
sig DataSource {}
sig Step {
requires: set Step
}
sig Database, File extends DataSource {}
sig Extract in Step {
@siraben
siraben / autocollect.sh
Last active February 9, 2021 18:59
macOS script to collect and dedup MAC addresses from a network
#!/bin/bash
# SPDX-License-Identifier: MIT
# SPDX-FileCopyrightText: 2018 Ben Siraphob <bensiraphob@gmail.com>
command -v gshuf >/dev/null 2>&1 || { echo >&2 "gshuf is required but is not installed. Run \"brew install coreutils\"."; control_c; }
command -v spoof-mac >/dev/null 2>&1 || { echo >&2 "spoof-mac is required but is not installed. Run \"brew install spoof-mac\"."; control_c; }
# Colors
RED='\033[0;31m'
NC='\033[0m'
@dpiponi
dpiponi / runner.py
Created August 27, 2020 15:34
Are these runners?
# Python 3
import collections
Write = collections.namedtuple("Write", ["written"])
def hello_world():
yield Write("Hello, world!")
yield Write("Hello, world!")
return 1
def identity(gen):
A short exact sequence is a sequence of maps:
f g h k
0 --> A --> B --> C --> 0
s.t.
Im f = Ker g
Im g = Ker h
Im h = Ker k
Example:
Require Import Coq.NArith.NArith.
Require Import Coq.Arith.Arith.
Require Import Coq.Lists.List.
Require Import Coq.Logic.Eqdep_dec.
Definition decidable (P: Prop) := {P} + {~P}.
Definition eq_dec T := forall (x y:T), decidable (x=y).
Inductive spec_type: Set :=
| abruption
@t184256
t184256 / window-juggler.py
Created March 14, 2020 23:49
A script to move my terminal window to/from my tablet when I leave/reenter the workspace, tmux + sway/i3
#!/usr/bin/env nix-shell
#!nix-shell -i python -p "python3.withPackages(ps: with ps; [ i3ipc ])"
# A script I've thrown together
# to use my tablet as a somewhat usable extra screen.
# The core idea is to ssh (mosh) to my work laptop,
# attach to a tmux session creating a new group (`tmux new-session -t tablet`)
# and then create a tmux binding to exchange windows between tablet and laptop
# (`bind Tab swap-window -t tablet`).
@albfan
albfan / .gitignore
Last active January 7, 2020 19:06 — forked from kontez/freeotp_backup.md
A guide to back up and recover 2FA tokens from FreeOTP (Android)
apps/
# Likes per tweet plot
# Analyze user's data downloaded from Twitter
library(jsonlite)
library(tidyverse)
# download your data from Twitter (Settings and Privacy, Your Twitter data), unzip the folder
setwd("~/Downloads/twitter-2018-10-29-6c18f5c0ab3605451f73cd0fd9ed186a2fd5b2caf1812ab747d42351da805656/")
json <- readLines("tweet.js")
Supporting examples 90 words (9 examples @ 10 words each)
Elevator pitch 50 words
Positioning statement 35 words
Headline benefits 24 words (3 benefits @ 8 words each)
Mission statement 20 words
Brand pillars 15 words (3 pillars @ 5 words each)
Target audience 15 words
Brand promise 10 words
@ion1
ion1 / 0readme.md
Last active October 22, 2018 18:52
Emulating the elegance of JavaScript's `new Array` in Haskell

Emulating the elegance of JavaScript's new Array in Haskell

What does new Array(x) do? Trick question. It does different things depending on whether x is an integer or something else.

I wanted to replicate this elegant functionality in Haskell: behold.