关注同步(synchronization)所需要的设施。
consensus: an elementary synchronization problem
consensus object: decide(), called at most once
function change_ts | |
set json $argv[1] | |
set img $argv[2] | |
set ts_epoch (jq '.photoTakenTime.timestamp' $json | grep --only-matching "[0-9]\+") | |
set title (jq '.title' $json | sed 's/^"\(.*\)"$/\1/') | |
set ts_fmt (date --utc --date=@$ts_epoch) | |
cp $img "../out/$title" | |
touch --date="$ts_fmt" "../out/$title" | |
end |
require 'romaji' | |
kana = {} | |
File.readlines('ciel').each do |line| | |
m = line.match(/([\p{Hiragana}\p{Katakana}ー]+)/) | |
kana[m[0]] = 1 if m | |
end | |
kana.keys.sort.each do |k| |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
const char *digits[] = | |
{ | |
"1110111", | |
"0100100", | |
"1011101", |
object <table-plural> : ... { | |
val <column> = ... | |
val <column> = reference(..., <another-table>) | |
... | |
} | |
=> | |
class User(id: EntityID<Int>) : IntEntity(id) { | |
companion object : IntEntityClass<User>(Users) |
<html> | |
<head> | |
<link rel="stylesheet" type="text/css" href="style.css" > | |
<script src="masonry.pkgd.js"></script> | |
</head> | |
<body> | |
<div class="grid" data-masonry='{ "itemSelector": ".grid-item", "columnWidth": 250 }'> | |
<? | |
$dir = scandir('Phone'); | |
$dir = array_filter($dir, function($item) { |
apt install git | |
git clone https://github.com/Wonicon/dotfile.git .dotfile | |
ln -s .dotfile/vim/vimrc .vimrc | |
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim | |
apt install -y fish ruby build-essential | |
apt install -y ruby-dev zlib1g-dev libxml2-dev |
#!/usr/bin/env ruby | |
# Uage: <script> <runscripts> <makefile> | |
runscripts = File.read(ARGV[0]) | |
makefile = File.open(ARGV[1], 'w') | |
configs = runscripts.each_line.map{ |line| line.split(' ')[4].split('/')[-1] } | |
makefile.puts("task := #{configs.map{ |c| "finish.#{c}" }.join(' ')}") | |
makefile.puts |
import org.antlr.v4.runtime.ParserRuleContext; | |
public class AntlrExt { | |
public static boolean underContext(ParserRuleContext curr, ParserRuleContext target, ParserRuleContext limit) { | |
do { | |
curr = curr.getParent(); | |
} while (curr.getRuleIndex() != target.getRuleIndex() && curr.getRuleIndex() != limit.getRuleIndex()); | |
return curr.getRuleIndex() == target.getRuleIndex(); | |
} | |
} |
import chisel3._ | |
import chisel3.util._ | |
import chisel3.iotesters._ | |
object GrayCounter { | |
def apply(bits: Int, inc: Bool = Bool(true), clear: Bool = Bool(false)): UInt = { | |
// Incremented | |
val next = Wire(UInt(width = bits)) | |
val curr = Reg(next = next) | |
next := Mux(clear, UInt(0), curr + inc.asUInt) |