Skip to content

Instantly share code, notes, and snippets.

View ErnWong's full-sized avatar
🦆

Ernest Wong ErnWong

🦆
View GitHub Profile

Awesome List of Rust Footguns

This will be a living document where I will ocassionally add new "gotchas" I discover with Rust. Do note that I am still learning Rust. I mean, who isn't?

Drops are not guaranteed

8 May 2021.

Dear diary,

@ErnWong
ErnWong / LimitsOfMarkdown.markdown
Created September 26, 2020 06:30
Can I make tower of Hanoi in Markdown?

E R N E S T   W O N G

ERNEST

@ErnWong
ErnWong / bash_testv_associative_arrays_with_quotes.sh
Created September 11, 2020 23:57
Potential bash test -v bug with associative arrays
#!/usr/bin/env bash
declare -A myarray
myarray["'"]="yes"
echo ${!myarray[@]}
echo ${myarray["'"]}
[[ -v myarray["'"] ]] && echo yes || echo no # Expected: "yes" printed. Actual: "no" printed.
# Tested on GNU bash version 4.4.20(1)-release
@ErnWong
ErnWong / Cellular Automata Train Simulation Idea.markdown
Created September 10, 2020 23:20
Cellular Automata Train Simulation Idea
  • Track Layer
  • Signalling Layer
  • Routing Layer
  • Train Layer
  • Track Circuit Layer
This file has been truncated, but you can view the full file.
7282
Pass 2 - terminal vocab - #7283
Pass 2 - terminal vocab - #7284
Pass 2 - terminal vocab - #7285
Pass 2 - terminal vocab - #7286
Pass 2 - terminal vocab - #7287
Pass 2 - terminal vocab - #7288
Pass 2 - terminal vocab - #7289
Pass 2 - terminal vocab - #7290
Pass 2 - terminal vocab - #7291
/home/ernwong/anaconda3/envs/NL2code/bin/python /home/ernwong/Downloads/Software/PyCharm/pycharm-professional-2020.1.1/pycharm-2020.1.1/plugins/python/helpers/pydev/pydevconsole.py --mode=client --port=35069
import sys; print('Python %s on %s' % (sys.version, sys.platform))
sys.path.extend(['/home/ernwong/uni/se700/part4project/NL2code'])
PyDev console: starting.
Python 2.7.17 |Anaconda, Inc.| (default, Oct 21 2019, 19:04:46)
[GCC 7.3.0] on linux2
>>> import os
/home/ernwong/anaconda3/envs/NL2code/bin/python /home/ernwong/Downloads/Software/PyCharm/pycharm-professional-2020.1.1/pycharm-2020.1.1/plugins/python/helpers/pydev/pydevconsole.py --mode=client --port=44163
import sys; print('Python %s on %s' % (sys.version, sys.platform))
sys.path.extend(['/home/ernwong/uni/se700/part4project/NL2code'])
PyDev console: starting.
Python 2.7.17 |Anaconda, Inc.| (default, Oct 21 2019, 19:04:46)
[GCC 7.3.0] on linux2
>>> runfile('/home/ernwong/uni/se700/part4project/cpp_parser.py', wdir='/home/ernwong/uni/se700/part4project')
Tokens From below From horizontal From above To below To horizontal To above
+ Yes ✔️ Yes ✔️ Yes ✔️ Yes ✔️ Yes ✔️ Yes ✔️
< No ❌ Yes ✔️ No ❌ Yes ✔️ Yes ✔️ Yes ✔️
> Yes ✔️ Yes ✔️ Yes ✔️ No ❌ Yes ✔️ No ❌
.,_ Yes ✔️ Yes ✔️ No ❌ Yes ✔️ Yes ✔️ No ❌
'`^* No ❌ Yes :hea

Ideally we want the following behaviour:

  • Feel the inertia of the hammer
  • Feel the "bump" as the action mechanism reaches the escapement stage
  • Re-engage above the escapement stage without a full reset
  • The keys should feel lighter when the damper pedal is pressed
  • Key should have an appropriately large radius of rotation as it is pressed so that the effective "weight" is roughly uniform regardless where the key is pressed from.

Essential components:

environment_genome.from_flattened({
'water_genes': [
{
'amount': 2.58712292237539,
'smell_signature': [-0.28899390479502074, -0.00830629590648524, 0.09767028130163857, -0.05182467021560022, 0.7185100142896303]
},
{
'amount': 1.439923830198761,
'smell_signature': [ 0.38302337370748285, -0.617770547361407, 0.8557760937332404, -0.7526113883887016, -0.34273501187112054]
}