Skip to content

Instantly share code, notes, and snippets.

View Arkham's full-sized avatar
🏠
Working from home

Ju Liu Arkham

🏠
Working from home
View GitHub Profile
@Arkham
Arkham / remote.md
Last active November 25, 2023 09:34
Remote, office not required

Remote, Office Not Required

The Time is Right for Remote Work

Why work doesn't happen at work

The office during the day has become the last place people want to be when then really want to get work done.

Offices have become interruption factories: it's just one interruption after

@Arkham
Arkham / kata.rb
Last active November 24, 2023 14:33
a functional altermative
# generate 100 random integers and store them in a file
STORE = "numbers.txt"
unless File.exists?(STORE)
File.write(STORE, 100.times.map { Random.rand(10) }.join("\n"))
end
numbers = File.read(STORE).split("\n").map { |n| n.to_i }
@Arkham
Arkham / fun.rb
Last active September 20, 2023 20:40
Fun with Ruby and a Raspberry PI
require 'pi_piper'
require 'ostruct'
laser = PiPiper::Pin.new(pin: 17, direction: :out)
alarm = PiPiper::Pin.new(pin: 18, direction: :out)
vibration = PiPiper::Pin.new(pin: 27, direction: :in)
i2c = PiPiper::I2C.new
def turn_on(pin)
pin.off
@Arkham
Arkham / 12-wasm.rs
Created December 13, 2022 22:00
aoc day 12 wasm fun
pub fn part_one(input: &str) -> Option<(Vec<Coords>, usize)> {
let board = Board::from(input);
run_dijkstra(
&[board.start],
|node| board.successors(node),
|node| node == &board.end,
)
}
let
sources = import ./nix/sources.nix { };
nixpkgs = import sources.nixpkgs { };
nixpkgs-ruby267 = import sources.nixpkgs-ruby267 { };
in nixpkgs.mkShell {
buildInputs = [
nixpkgs.go
nixpkgs-ruby267.ruby_2_6
];
}
@Arkham
Arkham / default.nix
Last active September 20, 2021 18:12
{ }:
let
sources = import nix/sources.nix { };
pkgs = import sources.nixpkgs { };
darwinInputs = with pkgs;
lib.optionals stdenv.isDarwin (with pkgs.darwin.apple_sdk.frameworks; [
AppKit
CoreFoundation
@Arkham
Arkham / MonadTrans.hs
Created April 19, 2021 13:45
A Monad Transformer tutorial
module MonadTrans where
import Control.Applicative (empty)
import Control.Monad (guard, join)
import Control.Monad.Trans.Class (lift)
import Control.Monad.Trans.Identity (IdentityT (..), runIdentityT)
import Control.Monad.Trans.Maybe (MaybeT (..))
import Control.Monad.Trans.Reader (Reader, ReaderT (..), ask)
import Data.List (intercalate)
import qualified Data.Map.Lazy as M
@Arkham
Arkham / design_everyday_things.md
Last active May 26, 2020 19:51
The Design of Everyday Things

The Design of Everyday Things

viii

Most accidents are attributed to human error, but in almost all cases human error was the direct result of poor design

x

When you have trouble with things — whether it’s figuring out whether to push or pull a door — it’s not your fault. Don’t blame yourself: blame the designer. When we see an object we’ve never used before, how do we know how to use it? The appearance of the device should provide the critical clues required for its proper operation — knowledge has to be both in the head and in the world.

xi

Conceptual Model. The human mind is a wonderful organ of understanding. A good conceptual model can make the difference between successful and erroneous operation of many devices in our life. Design is an act of communication between the designer and the user, except that all the communication has to come about the the appearance of the device itself.

module Robot where
robot (name, attack, hp) = \message -> message (name, attack, hp)
name (n, _, _) = n
attack (_, a, _) = a
hp (_, _, hp) = hp
@Arkham
Arkham / 1 - intro.rb
Last active April 26, 2019 14:51
Sonic PI experiments
# HI! I'm Ju. You can find me online as @arkh4m
# Download Sonic PI here: http://sonic-pi.net
def p(note, s: 1)
play note, release: s, cutoff: rrand(80,110)
sleep s
end
def fra_martino