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 python3 | |
import curses | |
import datetime | |
import locale | |
import noise | |
ROWS = 16 | |
COLS = 16 | |
def get_rows_and_cols(scr): |
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
calc <- decl expr | |
decl <- ('with' ident (',' ident)* ':')? | |
expr <- term (term_op term)* | |
term <- factor (factor_op factor)* | |
factor <- ident / number / '(' expr ')' | |
term_op <- < [+-] > | |
factor_op <- < [*/] > |
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
// Based on 'Easy immutable objects in Javascript' | |
// https://spapas.github.io/2018/04/05/easy-immutable-objects/ | |
const immutable_update = (obj, path, val) => { | |
if (!val) { | |
return path.reduce((obj, [path, val]) => immutable_update(obj, path, val), obj); | |
} | |
let parts = (typeof path === 'string' || path instanceof String) ? path.split('.') : path; |
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
#include <rocksdb/db.h> | |
class RocksDB { | |
public: | |
~RocksDB() { delete db_; } | |
rocksdb::Status open(const rocksdb::Options& options, std::string_view path) { | |
assert(!db_); | |
return rocksdb::DB::Open(options, std::string(path), &db_); | |
} |
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
function fzf-default() { | |
fzf --multi --ansi --select-1 --exit-0 --reverse --height '40%' | |
} | |
function fzf-cd() { | |
local DIR=$(fd --type d | fzf +m --ansi --select-1 --reverse) | |
if [ -n "$DIR" ]; then | |
cd $DIR | |
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
#include <cstdlib> | |
#include <iomanip> | |
#include <iostream> | |
#include <sstream> | |
#include "peglib.h" | |
using namespace peg; | |
using namespace std; | |
bool translate(const string& text, string& result) { |
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
[alias] | |
co = checkout | |
st = status | |
br = branch | |
ci = commit | |
l = log --date=short --pretty='format:%C(yellow)%h %C(cyan)%ad %C(green)%<(16,trunc)%an%Creset%C(yellow)%d%Creset %s' | |
lg = log --date=short --pretty='format:%C(yellow)%h %C(cyan)%ad %C(green)%<(16,trunc)%an%Creset%C(yellow)%d%Creset %s' --graph |
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
{ | |
"title": "For yhirose's HHKB", | |
"rules": [ | |
{ | |
"description": "Change Shift+Esc to ~", | |
"manipulators": [ | |
{ | |
"type": "basic", | |
"from": { | |
"key_code": "escape", |
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
Expr ← Sum | |
Sum ← Product (('+' / '-') Product)* | |
Product ← Value (('*' / '/') Value)* | |
Value ← [0-9]+ / '(' Expr ')' |
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
#define debug(...) { fprintf(stderr, __VA_ARGS__); fprintf(stderr, "\n"); } | |
// bash> tail -f debug.log | |
// bash> [command] 2> debug.log |
NewerOlder