This file contains 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
#!/usr/bin/env rdmd | |
// Get rdmd from https://dlang.org/download.html (or brew, nix, apt, yum) | |
// Copyright Lionello Lunesu. Placed in the public Domain. | |
// https://gist.github.com/lionello/84cad70f835131198fee4ab7e7592fce | |
import std.stdio : writeln; | |
int main(string[] args) { | |
import std.process : pipeProcess, wait, Redirect; |
This file contains 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
# name: Classic + Vcs (custom) | |
# author: Lily Ballard & Lionello Lunesu | |
function fish_prompt --description 'Write out the prompt' | |
set -l last_pipestatus $pipestatus | |
set -l normal (set_color normal) | |
# Color the prompt differently when we're root | |
set -l color_cwd $fish_color_cwd | |
set -l prefix |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
#!/usr/bin/env bash | |
usage () { | |
echo "Usage: $(basename $0) [--direnv] [--shell] [--default] -p|--packages packages... [--test]" | |
exit 0 | |
} | |
error () { | |
echo "Error: $1" | |
exit 1 |
This file contains 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
/** | |
* Wrap an Express middleware or handler for async support. | |
* @param {function} fn The middleware or handler to wrap | |
* @returns {function} Wrapped function | |
*/ | |
exports.wrap = function(fn) { | |
if (fn.length === 4) { | |
// Wrap error handler | |
return (err, req, res, next) => { | |
const r = fn(err, req, res, next) |
This file contains 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
/* | |
MIT License | |
Copyright (c) 2018 Lionello Lunesu | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is |
This file contains 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
#!/usr/bin/env node | |
const QR = require("qr-image"); | |
const arrayOf = (len, filler) => new Array(len).fill(filler); | |
const text = process.argv[2]; | |
const matrix = QR.matrix(text, "L"); | |
const topBottomPad = arrayOf(4, arrayOf(matrix[0].length, 0)); | |
const rowPad = arrayOf(4, 0); |
This file contains 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
#!/bin/bash | |
# | |
# Cache nix-shell environment | |
# | |
# - watches shell.nix (or default.nix), ~/.direnvrc and .envrc | |
# - based on https://github.com/direnv/direnv/wiki/Nix | |
# | |
use_nix() { | |
local shell_file=$(test -f shell.nix && echo shell.nix || echo default.nix) | |
if [[ ! -f "$shell_file" ]]; then return; fi |
This file contains 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
package main | |
import ( | |
"context" | |
"log" | |
"net/http" | |
"os" | |
"os/signal" | |
"syscall" | |
"time" |
This file contains 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
/* Use this with an overmind Procfile like this: | |
geth: geth --dev --rpc console | |
jest: pnpx jest --watchAll | |
*/ | |
const ChildProcess = require('child_process') | |
const Web3 = require('web3') | |
const Assert = require('assert') | |
function addressOf(contract) { | |
return contract.options.address |