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 | |
GOHOME="${1:-/usr/local}" | |
gophish() { | |
TARBALL="https://dl.google.com/go/$LATEST.linux-amd64.tar.gz" | |
ARCHIVE="/tmp/go.tar.gz" | |
echo "Downloading $TARBALL to $ARCHIVE..." | |
if ! wget -qc "$TARBALL" -O "$ARCHIVE"; then | |
echo "Failed to download the Go tarball." |
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 | |
# Get latest version's filename | |
filename=$(wget -qc "https://golang.org/dl/" -O - | grep -Pom 1 'go1\.\d{0,2}(\.\d{0,2})?\.linux-amd64\.tar\.gz') | |
# Remove old go version | |
rm -rf /usr/local/go | |
# Download and install new version | |
wget -c "https://dl.google.com/go/$filename" -O - | tar -xz -C /usr/local |
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
import { is, splice, leftApply, rightApply } from "./misc/utils"; | |
const queue = (obj) => rightApply(leftApply, obj); | |
const next = (elements) => elements.find((list) => list?.length) ?? []; | |
export default function Queue(type) { | |
const wrapped = queue({ type: is(type ?? Object), elements: [] }); | |
return { |
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
const globals = {}; | |
const shouldExtend = (reference, key) => | |
Array.isArray(reference[key]) || | |
!(reference.hasOwnProperty(key) && typeof reference[key] === "object"); | |
const cleanPath = (array) => | |
array.reduce((a, b) => (b !== "global" ? a : [...a, b.trim()]), ""); | |
const set = (key, value) => { |
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
<?php | |
class Label | |
{ | |
private $label; | |
public function __construct(string $label) | |
{ | |
$this->label = $label; | |
} |
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
type Vector = [number, number]; | |
/** Returns an array of length 2 representing a vector. */ | |
export const vector = (x: number, y: number): Vector => [x, y]; | |
/** Returns a uniform vector with its elements having the given value. */ | |
export const uniform = (n: number) => vector(n, n); | |
/** Clones a given vector. */ | |
export const clone = (a: Vector) => vector(a[0], a[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
import functools | |
def identity(func): | |
return func | |
def partial(func, *args, **kwargs): | |
return functools.partial(func, *args, **kwargs) |
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
import functools | |
def compose(*fns): | |
fns = reversed(fns) | |
def composed(arg): | |
return functools.reduce(lambda x, fn: fn(x), fns, arg) | |
return composed |
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
const { app, BroweserWindow } = require('electron'); | |
/* Utilities */ | |
const insert = (array, value, first = false) => | |
first ? [value, ...array] : [...array, value]; | |
const expulse = (array, prop, value) => array.filter(e => e[prop] !== value); | |
const repeat = (fn, n = 1, ...args) => { |