Skip to content

Instantly share code, notes, and snippets.

View taskie's full-sized avatar
🐌
𝑩𝑳𝑨𝒁𝑰𝑵𝑮 𝑭𝑨𝑺𝑻

taskie taskie

🐌
𝑩𝑳𝑨𝒁𝑰𝑵𝑮 𝑭𝑨𝑺𝑻
View GitHub Profile
#!/usr/bin/env python3
start_state = (1 << 11) | 1
lfsr = start_state
period = 0
for i in range(1023):
print(f"{i:04d} {lfsr:-012b} {lfsr:-03x}")
bit = (lfsr ^ (lfsr >> 1) ^ (lfsr >> 3) ^ (lfsr >> 8)) & 1
lfsr = (lfsr >> 1) | (bit << 11)

Keybase proof

I hereby claim:

  • I am taskie on github.
  • I am taskie (https://keybase.io/taskie) on keybase.
  • I have a public key ASCG-8-lrHhHkPbnB9MLYgMDZKeaqCG_ZskG9m2KCT7alwo

To claim this, I am signing this object:

@taskie
taskie / findup
Created July 9, 2021 15:35
サブディレクトリにいたまま make(1) したいという気持ち
#!/bin/sh
set -eu
die () {
printf "$(basename "$0"): %s\n" "$*" >&2
exit 1
}
get_device () {
stat -c '%d' "$1"
// http://www.kb.ecei.tohoku.ac.jp/~sumii/class/keisanki-software-kougaku-2005/lambda.pdf
type Abstraction<I extends AnyVariable, T extends AnyExpr> = [1, I, T];
type Application<T extends AnyExpr, U extends AnyExpr> = [2, T, U];
type Expr<I extends AnyVariable, T extends AnyExpr, U extends AnyExpr> = AnyVariable | Abstraction<I, T> | Application<T, U>;
type AnyVariable = string;
interface AnyAbstraction extends Abstraction<AnyVariable, AnyExpr> {};
interface AnyApplication extends Application<AnyExpr, AnyExpr> {};
type AnyExpr = AnyVariable | AnyAbstraction | AnyApplication;
package main
import (
"bufio"
"bytes"
"encoding/json"
"fmt"
"os"
log "github.com/sirupsen/logrus"
@taskie
taskie / dcp.bash
Last active October 30, 2018 16:34
diff then cp (bash)
#!/usr/bin/env bash
set -eu
PROGRAM="$(basename "$0")"
usage () {
cat <<EOF
${PROGRAM}: diff then cp
Usage:
@taskie
taskie / dcp.sh
Last active October 30, 2018 15:33
diff then cp
set -eu
PROGRAM="$(basename "$0")"
usage () {
cat <<EOF
${PROGRAM}: diff then cp
Usage:
${PROGRAM} [-f|-i] SRC DEST
@taskie
taskie / bashism.sh
Last active October 28, 2018 18:01
#!/usr/bin/env bash
# for GNU bash 3.x on Linux
declare PROGRAM_NAME="$(basename "$0")"
declare PROGRAM_DIR="$(realpath "$(dirname "$0")")"
function usage () {
cat <<EOF
${PROGRAM_NAME} - some nice program
export type State<Source> = {
source: Source;
position: number;
completed: boolean;
};
export function State<Source>(
source: Source,
position?: number
): State<Source> {
import io
import subprocess
import functools
import copy
import os
import sys
from collections import ChainMap
__version__ = '0.0.1'
_debug = False