Skip to content

Instantly share code, notes, and snippets.

View weakish's full-sized avatar

weakish weakish

View GitHub Profile
@weakish
weakish / LICENSE
Created July 23, 2017 09:58
new tab #extension for #chromium
Permission to use, copy, modify, and/or distribute this software
for any purpose with or without fee is hereby granted.
This software is provided "as is" without express or implied warranty.
@weakish
weakish / Exercise-125_sum.rkt
Created July 23, 2017 09:42
htdp 2e. exercise 125 #racket
#lang racket
(require lang/htdp-beginner)
; Htdp 2e. Exercise 125
;
; A List-of-amounts is one of:
; – empty
; – (cons PositiveNumber List-of-amounts)
; interp. a List-of-amounts represents some amounts of money
@weakish
weakish / gpgxz.sh
Created July 23, 2017 09:40
#encrypt a directory with #gnupg and #xz in #sh
#!/bin/sh
# Encrypt a directory with gnupg and xz.
#
# Usage:
#
# gpgxz dir
#
# This will tar the directory, compress it with xz,
# and sign and encrypt it with the current user's gnupg key.
@weakish
weakish / Notes-on-The-autobiography-of-Benjamin-Franklin
Last active July 22, 2017 13:03
#afterwords on The #Autobiography of #BenjaminFranklin
> I believe I have omitted mentioning that, in my first voyage from
> Boston, being becalm'd off Block Island, our people set about catching
> cod, and hauled up a great many. Hitherto I had stuck to my resolution
> of not eating animal food, and on this occasion consider'd, with my
> master Tryon, the taking every fish as a kind of unprovoked murder,
> since none of them had, or ever could do us any injury that might
> justify the slaughter. All this seemed very reasonable. But I had
> formerly been a great lover of fish, and, when this came hot out of the
> frying-pan, it smelt admirably well. I balanc'd some time between
> principle and inclination, till I recollected that, when the fish were
@weakish
weakish / chindogu_test.rb
Created July 22, 2017 11:57
An attempt to #port #gambiarra / #klud.js #minimal #unit-testing to #Ruby
# An attempt to port [gambiarra/klud.js][t] to Ruby.
#
# [t]: http://zserge.com/blog/minimal-testing.html
currentTest = nil
expected = []
actual = []
define_method(:tesuto, ->(e, test_function, msg) do
currentTest = {}
if e == 'begin'
@weakish
weakish / KnR-c.md
Created July 22, 2017 07:29
#afterwords on #K&R #C #Programming 2ed.

K & R The C Programming Language 2ed.

Section 4.2

The function atof must be declared and defined consistently. If atof itself and the call to it in main have inconsistent types in the same source file, the error will be detected by the compiler. But if (as is more likely) atof were compiled separately, the mismatch would not be detected (p.63)

Actually both gcc and clang can detect the mismatch across files. (Tested on gcc 4.8.2 and clang 3.4.)

@weakish
weakish / Main.java
Created July 10, 2017 13:42
#playground code on reading effective #java
import java.util.ArrayList;
class DefaultValueInstanceVariable
{
private int m;
private int n; // IntelliJ warns "private field is never assigned".
DefaultValueInstanceVariable(int x)
{
m = x;
}
@weakish
weakish / README.md
Last active November 26, 2016 15:52
Run `you-get` with multiple urls, written in #Go.

Usage:

cat one-url-per-line.list | you-get-all

License: 0BSD

@weakish
weakish / 奇异博士跋.md
Last active November 17, 2016 17:24
奇异博士 #跋

剧情的架构是有不小潜力的,具有天赋却踏上不归路的学生,阻止黑暗却依赖黑暗生存的师长,这个已经很有张力了,配上科学理性和玄学的冲突、是否恪守自然的冲突,描写深刻会很出彩。

或者,就像《环太平洋》一样,搞一个无脑剧情,避免观众被剧情分心,专心享受特效,也是很好的选择。

但是最终选择了复杂的架构,却潦草带过,沦为粗糙的中庸。

古一法师虽然出彩,却是靠服装、扮相、表演撑起来的,性情上着墨其实并不多,只有死前一番话集中体现了性情。而且通过死前的大段独白(虽然形式是对话,但两人其实并无实质的对撞,其实就是独白)表明人物性情显得很笨。要命的是这段独白还不精彩,想表达宿命感却给人撩摊子的感觉,表达对死亡的洒脱说教味太浓,表达对生的眷恋像在附庸风雅。

卡西利亚斯就可怜了,符号化,像是在例行公事。手下一帮小弟就更是一团模糊了。要知道这类英雄片反派应该是比主角重要的(因为英雄片主角基本只能站在正义一边,容易套路,而反派无论动机还是行事都能更多样)。

@weakish
weakish / common-plain-markup.txt
Created November 16, 2016 14:56
common subset of #MarkDown, #ReStructedText, and #AsciiDoc
MarkDown vs. ReStructuredText vs. Asciidoc
==========================================
.::
**strong emphasis text**
``literal`` (compatible with Asciidoctor)
> blockquote is compatible with Asciidoctor,
* unordered list item
- unordered list item