inanna@inanna-x1-carbon:~/dev/phf_bug_demonstrator$ rustup default 1.40.0
info: using existing install for '1.40.0-x86_64-unknown-linux-gnu'
info: default toolchain set to '1.40.0-x86_64-unknown-linux-gnu'
1.40.0-x86_64-unknown-linux-gnu unchanged - rustc 1.40.0 (73528e339 2019-12-16)
inanna@inanna-x1-carbon:~/dev/phf_bug_demonstrator$ cargo build
Compiling phf_bug_demonstrator v0.1.0 (/home/inanna/dev/phf_bug_demonstrator)
Finished dev [unoptimized + debuginfo] target(s) in 0.14s| //stack-safe anamorphism (unfolding change). Builds a tree layer by layer. | |
| pub fn ana<X>(f: impl Fn(X) -> Tree<X>, seed: X) -> FixTree { | |
| let mut instructions: Vec<Option<X>> = vec![]; // depth first, Some == add child w/ seed, None == back a level | |
| let mut path_to_root: Vec<&mut Vec<Box<FixTree>>> = vec![]; // pointer to children of focused node | |
| // ^ this breaks it, requires multiple borrows... drop this in a gist (or use refcel, rain says to do so) | |
| let root = f(seed); | |
| match root { | |
| Tree::Leaf(n) => FixTree(Tree::Leaf(n)), |
I’ve been setting up structured journal entries recently - quick morning notes, weekly and quarterly retrospectives, etc. As part of this I’ve been curating a list of questions to help self-assess how I’m doing at any given time.
Some of these questions are simple bio-maintenance checklist entries: how’s my diet? Am I getting enough sleep? Are my cholesterol and triglyceride levels normal? Have I been getting enough vitamin D? Have I been doing resistance exercise recently? Cardio?
Then come some less concrete questions: have I been keeping myself intellectually engaged? Have I been engaging in some regular form of artistic creation? When’s the last time I did something nontrivial just for the fun of it? Aside from work stuff, when’s the last time I finished a project? Speaking of work, how are things there? Attempts to answer that question could fill multiple blog posts, so for now I’m going to focus on a specific angle pointed out by
| URxvt.scrollBar: false | |
| urxvt*termName: rxvt | |
| urxvt*font: xft:uushi:pixelsize=16 | |
| urxvt*boldFont: | |
| urxvt*background: #000000 | |
| urxvt*foreground: #666699 | |
| urxvt*cursorColor: #6699CC | |
| urxvt*colorBD: #CCCCFF | |
| !Visiblue |
| # If you come from bash you might have to change your $PATH. | |
| # export PATH=$HOME/bin:/usr/local/bin:$PATH | |
| # Path to your oh-my-zsh installation. | |
| export ZSH=/home/pk/.oh-my-zsh | |
| #needs to be before theme | |
| POWERLEVEL9K_MODE='awesome-fontconfig' | |
| # git clone https://github.com/bhilburn/powerlevel9k.git ~/.oh-my-zsh/custom/themes/powerlevel9k |
| " install plugins. (requires running :PlugInstall) | |
| " Specify a directory for plugins (for Neovim: ~/.local/share/nvim/plugged) | |
| call plug#begin('~/.vim/plugged') | |
| " Make sure you use single quotes | |
| Plug 'altercation/vim-colors-solarized' | |
| Plug 'scrooloose/nerdtree' | |
| Plug 'scrooloose/nerdcommenter' | |
| Plug 'scrooloose/syntastic' |
| scala> val f: Function[Int, Int] = { n => n + 1 } | |
| f: Function[Int,Int] = <function1> | |
| scala> val f: Function[Int, Int] = { case n => n + 1 } | |
| f: Function[Int,Int] = <function1> | |
| scala> val pf: PartialFunction[Int, Int] = { n => n + 1 } | |
| <console>:10: error: type mismatch; | |
| found : Int => Int | |
| required: PartialFunction[Int,Int] |
| //send messages via Pusher API in play 2.4 | |
| import play.api.libs.json.{ Writes, Json } | |
| import play.api.libs.ws.{ WSResponse, WSClient } | |
| import play.api.libs.ws.ning.NingWSClient | |
| import java.security.MessageDigest | |
| import java.math.BigInteger | |
| import javax.crypto.Mac | |
| import javax.crypto.spec.SecretKeySpec | |
| import scala.concurrent.{ ExecutionContext, Future } |
| # https://gist.github.com/oliversalzburg/a57a8b82dd8ec245f985 | |
| function _common_section | |
| printf $c1 | |
| printf $argv[1] | |
| printf $c0 | |
| printf ":" | |
| printf $c2 | |
| printf $argv[2] | |
| printf $argv[3] |
| def fibonacci(number: Int): Int = { | |
| assert(number >= 0) | |
| @annotation.tailrec def inner(prev: Int, curr: Int, n: Int): Int = | |
| if (n < number) inner(curr, prev + curr, n + 1) | |
| else curr | |
| if (number == 0) 0 | |
| else if (number == 1) 1 | |
| else inner(0, 1, 1) |