Learning
A Few Things I Learn Every Day Week
Hey! This hasn’t been updated in a while. Has Marc learned anything after January of 2021?
That’s a good question. I’m writing this in mid-May of 2021. The past few months I’ve been kept busy between my co-op at Vicarious Surgical, and doing research work on developing atom rearrangement algorithms for large Rydberg atom arrays. Both of those have just concluded, and here I am on my two-day summer vacation before I start as an intern at Facebook.
This learning log began as a way for me to give my days some structure over quarantine, in August of 2020. When my classes began in fall, this log helped me feel accountable to make my schoolwork interesting and exciting – if I’m attending classes almost every day, I’m surely going to be able to find something interesting about them to write a few bullet points about. Some days I wrote more than others, and some days I forgot to write an entry and then had to think really hard the next day to catch up.
When my co-op started, I began to struggle to keep up with these logs. I questioned if I was actually learning anything on co-op, and began to be worried about what having a career would look like. At work I was certainly doing new things and getting better at existing skills, but I struggled to quantify that.
I am looking back on these past few months and at the same time I am looking out my window at the big tree outside. From my second floor window it stands swaying with green buds on fresh branches. The shoots have not made the tree much taller than it was last year, but the quality of the tree has changed – the leaves are denser, the canopy wider, the once green twigs now strong branches bearing sprouting leaflets.
Measuring your tree every day with a ruler is, in some strange way, fun. But leaves rustle, branches sway, twigs bend, and boughs fall from wind and rain. The tree will feel static until one day in May when you will look at the tree with fresh eyes, and be surprised at just how much has changed.
I try to learn or discover something new every day. Here are some of the things that I get excited about! Dates in YYYY-MM-DD.
Update December 14, 2020: Switching to a weekly format, instead of daily updates.
Week of 2021-01-25
-
JavaScript has a way to check for null fields inline
`const foo = {a: “first”, b: [“second”, {c: “third”}]};
foo?.a // “first” foo?.c // undefined
foo?.a? // “first” foo?.b?.[1]?.c // “third” foo?.b?.[1]?.d // undefined`
-
When serving a React single-page app that uses React-Router with nginx, you’ll need to change the
locationblock in the configuration file to this. This tells nginx to forward other requests to the index.html file as well.location / { try_files $uri /index.html; } -
Cantor’s diagonalization argument; there are more reals than whole numbers
Week of 2021-01-18
- Finished reading Anna Karenina (finally!); Libby says I read it for 15 hours and 38 minutes total which definitely shouldn’t have taken me 7 months.
- Learned TypeScript last week. Turns out it’s called TypeScript because the syntax requires so much typing.
- Printing a line to console with
\r(carriage return) puts the cursor at the beginning of the line, meaning that the next line you print will overwrite the previous line. - Worked a ton with React, Tailwind CSS, and Firebase
- Learned a lot about the robot and systems at work
- These past weeks I’ve learned that it’s pretty hard to learn things when one has work. I’m definitely learning a lot through work, but I’m not sure how to write down those things I learn. I’m hoping this is because it’s generally hard to write down learnings, rather than that I’m not really learning anything. It’s easy to write down buzzwords, syllabi topics, and short snippets of code, but the types of things I’m learning at work is how to do things. That’s probably the whole point of co-op, whereas learning things is what you get through classes and academia. I like learning things.
- React’s
useEffect()hook is akin to Verilog’salways@()statement, where assignments get updated whenever a register in the dependency list changes value. This is cool. - You can make your own directional wifi antenna with a can of beans and a coaxial connector. Turns out wifi is more than just magic.
Week of 2021-01-11
- We know about
snake_case, but the official name for its cousin isSCREAMING_SNAKE_CASE😱 - Share terminal app as a web app. This would be perfect for my air quality monitoring script.
- Re-familiarized myself with working with Pandas and seaborn
- Got comfortable with working with Postgresql and jsonb documents
- To get that fancy conda env tab in Jupyter notebook,
conda install nb_condain yourbaseenv or whichever environment you start Jupyter notebook from should do the trick. - Make custom blobs
- Create Tailwind or other UIs visually real quick
Week of 2021-01-04
-
I (re)learned React. I also learned TypeScript and am very much enjoying typed callback functions. I also finally took a course on CSS instead of Googling “how to center a div” for the millionth time. I’ve been enjoying Tailwind UI’s components as well as ANT Design’s charts and graphs.
-
The complex analogue of an orthogonal matrix, and , is the unitary matrix, where , so that . The complex analogue of a symmetric matrix, , is the Hermitian matrix, where .
-
9 and 11 have this intriguing property:
where . For example, and .
where . For example, and .
-
With edX’s switch to hosting video files on their own server, the old
edx-dltool no longer works. Fortunately, someone has made a fork of the repo that does work. -
ffmpeg -i video.mp4 -i audio.m4a -acodec copy -vcodec copy output.mp4to merge separate audio and video tracks -
Quantum Flytrap for super cool quantum mechanics demonstrations
-
List comprehensions in Haskell are brilliant. Fizzbuzz:
fizzbuzz z = [if xmod3 == 0 then "fizz" else if xmod5 == 0 then "buzz" else show x | x <- [1..z]]
Week of 2020-12-28
-
The DFT’s Fourier matrix is constructed where the ’th element of is , when . is the size of the square matrix, and is a root of unity. A root of unity is a complex number that, when raised to some power , yeilds . We could write , since then by Euler’s identity. Often, when this matrix is used, the factors are normalized by , so you could write the ’th element of is .
[F_n=\frac{1}{\sqrt{n}}\begin{bmatrix} w^0&w^0&w^0&w^0&\cdots&w^0\ w^0&w^1&w^2&w^3&\cdots&w^{n-1}\ w^0&w^2&w^4&w^6&\cdots&w^{2(n-1)}\ w^0&w^3&w^6&w^9&\cdots&w^{3(n-1)}\ \vdots&\vdots&\vdots&\vdots&\ddots&\vdots\ w^0&w^{n-1}&w^{2(n-1)}&w^{3(n-1)}&\cdots&w^{(n-1)(n-1)} \end{bmatrix}]
-
Turning off night shift on mac stops external monitor flickering
-
How to use the mask layer in Affinity Photo
-
Blue + Red O-rings on Cherry Blue switches limits the travel the perfect amount – just past the click you hit the nice and soft bottom out.
-
On linux, script to center the active window
Week of 2020-12-21
-
If your basis states are and , then , and you can even define circular polarization with .
-
When we are dealing with qubits, the reason we can express a qubits’ 2-dimensional complex vector space as a 3-dimensional real vector space is because we also know that a qubit’s vector within this 2D complex vector space is normalized. We know for sure that the length is one, so we can represent all this data with just 3 real dimensions instead of 4.
-
Complexity class #P (Sharp P) is the class of problems dealing with counting the number of solutions to a problem in complexity class NP. #P is outside of both P and NP. Then you can count the number of counting problems, and so on and so forth. “This is how you get a career as a theoretical computer scientist” – Isaac Chuang
-
Learned how to set up the Kong API gateway and use Artillery for testing API speed and throughput.
-
To set Go version in a Heroku app, you can set the
GOVERSIONconfig var to be your version, like1.15. -
Website response times aren’t Gaussian, but can be better approximated by a Log-normal or Erlang distribution.
-
To remap keys on Linux, edit
/usr/share/X11/xkb/symbols/pc. Remove the xkb cache withsudo rm -rf /var/lib/xkb/*, then reboot. -
To show statistics from curl, can use this function in
/.zshrc:function perf { curl -o /dev/null -s -w "%{time_connect} s connect + %{time_starttransfer} s transfer = %{time_total} s total\n" "$1" }
Week of 2020-12-14
I’ve just finished my final exams, and I’m going to be switching to a weekly format for my log of learnings. I’m hoping this will be more sustainable particularly over the holidays, as well as allow me to put down not just tidbits of learnings but also the progress towards substantial goals that I’m working towards.
-
Wrote a blog post about the proofs for two unique properties of Hermitian operators. Why are the eigenvalues always real? Why are the eigenvectors always orthogonal? Find out now.
-
To make
HomeandEndkeys work on an external keyboard on mac, create file~/Library/KeyBindings/DefaultKeyBinding.dictand in it put{ /* Remap Home / End keys */ /* Home Button*/ "\UF729" = "moveToBeginningOfLine:"; /* End Button */ "\UF72B" = "moveToEndOfLine:"; /* Shift + Home Button */ "$\UF729" = "moveToBeginningOfLineAndModifySelection:"; /* Shift + End Button */ "$\UF72B" = "moveToEndOfLineAndModifySelection:"; /* Ctrl + Home Button */ "^\UF729" = "moveToBeginningOfDocument:"; /* Ctrl + End Button */ "^\UF72B" = "moveToEndOfDocument:"; /* Shift + Ctrl + Home Button */ "$^\UF729" = "moveToBeginningOfDocumentAndModifySelection:"; /* Shift + Ctrl + End Button*/ "$^\UF72B" = "moveToEndOfDocumentAndModifySelection:"; } -
You can install Apple
system-uifonts from https://developer.apple.com/fonts -
If you run 120VAC through a pickle, you get pure sodium light from the Na+ and Cl- ions produced from pickling.
-
“Once you open the box, however, it will either be dead or alive – the superposition will have collapsed to a single state. This is a bit of an unrealistic experiment, but it does illustrate one key point: Schrödinger did not like cats. This also illustrates the point that QM assumes no knowledge of anything that is not experimentally observable, because observation has the potential to change the outcome of later experiments.” - MIT OCW
2020-12-13
- swillkb keyboard plate builder … new keyboard sometime soon? Uses layout from keyboard layout editor
2020-12-12
- 2020’s Sexiest Prime Number Couples. I didn’t expect 67 and 73 to be so high up 🤭
2020-12-11
- . Finding the sum, for sufficiently large , is akin to finding the area under the curve. Didn’t learn this but I definitely forgot it previously.
- Adding 1 to all the edge weights in a graph does not preserve the minimum weight path. You could have a situation with two paths from a source to a sink, one with 10 edges and one with only one edge. The path with 10 edges, while it may be less weight than the path with only one edge, will increase by weight 20, whereas the path with only one edge will increase by only 1.
- The Human Connectome Project
2020-12-10
- I need to devote some time every week (maybe on Saturday mornings) to do all the tiny but important things that I need to do but never get around to, like checking my credit card statement, doing work for that one class, making sure my backups are working, etc.
2020-12-09
- Strange Chinese domains like
.xn--czru2dare actually supposed to be displayed as Chinese characters, due to Internationalized Domain Names (IDN). The domainxn--45q11cis supposed to be displayed as.八卦, meaning “gossip”. - This super approachable lecture notes on the Fast Fourier Transform, by Jeff Erickson who has a great book on algorithms in general.
- Incrementing and decrementing a binary counter using Gray Codes is always constant time, because Gray codes hold the invariant that adjacent binary numbers differ only in 1 bit. Gray codes are also cyclic, in that to roll over from 15 to 0 also requires only one bit flip. Gray codes can even provide a solution to the Towers of Hanoi puzzle. Here’s a recent paper on using Gray codes to reduce noise in quantum computing! It covers how to create operators that work on qubits with Gray encoding, and shows how it can be much more qubit efficient than the Jordan-Wigner encoding.
2020-12-08
- Super Mario is not just NP Hard but NP Complete. So is Zelda, Pokemon, and several others.
- 2020 State of European Technology
2020-12-07
- In 2018, 2.6 million articles were published in peer reviewed journals, up from 1.8 million in 2008.
- This research paper on how human language reveals a universal positivity bias
- Theo Jansen, inventor of the Strandbeest, explains the wind.
2020-12-06
- The 12 Factor App
- Everything you need to know about installing/uninstalling Redis on mac
- Drawbridge is the last ghost town in the San Francisco Bay Area
2020-12-05
- Watch the Arecibo telescope collapse :¬(
- Where to sit in a car and which windows to open in a car with a potentially virulent COVID-19 patient, according to a new study from Brown. In the most common seating arrangement in ridesharing services where the passenger sits in the rear right seat and the driver in the front left, opening the windows opposite the occupants generates a diagonal flow of air through the car that separates the passenger’s air from the driver’s air. According to the fluid modeling of this study, usually air flows into the car from the rear windows, and exits the car from the front windows when all windows are open. The best is to open all four windows. “Driving around with the windows up and the air conditioning or heat on is definitely the worst scenario.”
2020-12-04
-
If you have a qudit, or a -valued version of a qubit, the pure states are . In a 2-state qubit, the pure states are of course just and . A pure state of
-
The Fredkin gate in quantum computing (CSWAP) takes 3 inputs and swaps two of them based on the input of the third. The matrix form conserves ’s and ’s, which by the billiard-ball model indicates that the gate conserves energy/information.
[\begin{bmatrix} 1&0&0&0&0&0&0&0\ 0&1&0&0&0&0&0&0\ 0&0&1&0&0&0&0&0\ 0&0&0&1&0&0&0&0\ 0&0&0&0&1&0&0&0\ 0&0&0&0&0&0&1&0\ 0&0&0&0&0&1&0&0\ 0&0&0&0&0&0&0&1\ \end{bmatrix}]
-
Solving 3-SAT using 3 different quantum approaches: quantum circuits, quantum register machines, and quantum membrane computing
-
hedonometer.org of Twitter sentiment over time. Every Christmas since 2015 has been sadder than the year before. The variance in the trend is increasing: maybe due to media that is made to incite outrage, fear, and anger, there are more spikes and dips in recent years than ever before. May 30, 2020 was the saddest day in the history of Twitter.
Yesterday was the saddest day in the history of @Twitter pic.twitter.com/91VP3Ywtnr
— hedonometer (@hedonometer) May 30, 2020
2020-12-03
-
If you have a set of points in a vertical line, spaced apart, and another point away from the very first point, and you draw lines connecting that top point to each point on the line, the angle formed by . With infinitely many points, . As you add points, , meaning that the angle changes proportional to when is a constant. This is both cool and neat.
<-length l-> | | *----------* + \ Θ | \ | \ | distance d \ | \ | * + more points down here, d distance away and so on...
2020-12-02
- You’ve heard of salting passwords, but what about peppering passwords?
- Involuntary memories is the name for that thing….
2020-12-01
<mark>to highlight stuff in markdown and html- Edge-disjoint paths are paths on a graph between the same source and sink that don’t share any edges in common. You can find edge-disjoint paths using a reduction to integer max flow on a graph, in time.
2020-11-30
- If MacOS refuses to open an app from an unidentified developer (claiming that the code is damaged), run
xattr -cr /path/to/application.appto clear the permissions and allow it to run.
2020-11-29
rm -rto delete a directory is not implemented in in the file system: thermcommand literally just recurses through every single item (and nested items) in the folder and deletes them first individually. Thermdirfile system call only allows deleting empty directories.- Most operating systems don’t allow hard links to directories, where two directory entries point to the same, another directory inode. This can get complicated mainly in avoiding cycles.
2020-11-28
- If you need to implement a priority queue that has a fixed number of values for the primary ordering (like if you are storing scheduling appointments by the minute, you only have minutes), you can use a lookup-based approach where in a array that stores the number of requests that start at the row index and end at the column index. In another array, store the number of requests that end that minute. Then you can traverse your fixed length 1D array, and find the first ending time to traverse for in your 2D array. This is asymptotically constant time, since is a constant. This can be pretty slow though in practice.
- Added the outline on the left hand side. I used jekyll-toc
2020-11-27
-
Java won’t support arrays of generic types, like
List<Foo>[]. Check out this counterexample:List<String>[] liz = new ArrayList<String>[10]; // ILLEGAL Object[] objs = liz; // is fine, since List<String> is subclass of Object List<Integer> ints = new ArrayList<Integer>; ints.add(42); objs[0] = ints; String ohno = liz[0].get(0); // oh no! liz now contains integers!
2020-11-26
chararrays are not automatically null terminated in C, but string literals are.- Simple Fuse API calls to implement a bare bones file system 🎉
2020-11-25
-
Always put extra parenthesis in your C functions in macros to to avoid order of operations errors, particularly around any parameters. Example:
#define CEIL(x) ((x) == (double) (int) (x) ? (int) (x) : (int) (x) + 1) // is ok #define CEIL(x) (x == (double) (int) x ? (int) x : (int) x + 1) // not ok -
Virtualbox cursor not working in the top left quadrant of the screen is an issue with drag and drop, through the Virtualbox guest tooling. If you try to drag something from outside the VM into the VM it fixes the issue.
2020-11-24
- The opposite of “OG” (Original Gangster) is “BG” (Baby Gangster)
- Lao Gan Ma has changed since my childhood 😭
- In C, cast a void pointer to an array like
int[] arr = (int (*)[ARR_SIZE]) memwherememis a void pointer.
2020-11-23
-
Really great explanation on how the xv6 operating system works, or really most unix operating systems.
-
Clean example of how to set up a simple FUSE project using CMakeLists. You’ll want
CMAKE/FindFUSE.cmakeand then add toCMakeLists.txt:`set(CMAKE_C_FLAGS “{CMAKE_C_FLAGS} -D_FILE_OFFSET_BITS=64") set(CMAKE_MODULE_PATH "{CMAKE_CURRENT_SOURCE_DIR}/CMake” ${CMAKE_MODULE_PATH}) find_package(FUSE REQUIRED)
include_directories({FUSE_LIBRARIES})`
2020-11-22
-
Tenets of the Unix philosophy. Excerpt from The Art of Unix Programming book:
Rule of Silence: When a program has nothing surprising to say, it should say nothing.
This is probably why
diffreturns nothing if files are the same. -
Most of the things I actually learn, don’t end up on this page. This has become (or always was?) a subset of little tidbits, facts, links that I stumble across. I don’t really attribute much meaning to any individual bullet point on this page, whereas I do find lots of value in big learnings like designing a memory allocator or understanding how the quantum fourier transform works. Most things worth learning aren’t things you pick up in a day, but things you work at over long periods of time. Mastery comes from incremental improvement, and while I’m far from that in anything, incremental learning is difficult to quantify beyond cute little discoveries/tricks/hacks. How do I measure how good I am at improvising a jazz solo over the Bb blues?
On balance, a lot of these entries are minute things that I do want to remember or come back to, like yesterday’s learning about vim clipboard settings. Perhaps, like many other things in life, these minute learnings may have little meaning by themselves, but when taken together and considered as a whole, they become something special.
It’s almost the 3 month anniversary of me starting to do this. When I look back at a random day, I’m surprised how the things I’ve recorded can jog my memory and help me recall the happiness, sorrow, and meaning that I’ve been so incredibly fortunate to have experienced in my short existence. I’m glad that I do this.
2020-11-21
set clipboard=unnamedin vim makes vim use the system clipboard instead of its own; so you can copy and paste withyandpand have it work with the system.- On linux you can view the CPU temperature in
cat /sys/class/thermal/thermal_zone0/temp: divide by 1000 to get degrees Celsius. - power level 10k
2020-11-20
- How the Ford-Fulkerson algorithm uses residual graphs to find the maximum flow function for a graph
- Water Droplet Surviving An Attempt To Be Cut By A Knife
- The shapes of raindrops
- Some substances, like bitumen, appear to be solids but are actually liquids. The Pitch Drop Experiment has the record for the longest continually running laboratory experiment, and consists of a cone of pitch that is dripping at a rate of once per decade since 1930. Watch the live stream here – the tenth drip is expected in 8 years (as of writing).
2020-11-19
- octothorpe is another word for the hash symbol
- Herbie Hancock’s awesomely weird music videos
2020-11-18
- How to modify the x86_64 xv6 operating system to add a new syscall
2020-11-17
-
Stylish Dinner to the Beat of Jazz, Accompanied by Domestic Artists (Finnish)
-
As of a recent lawsuit, the USPS is required to publish statistics. This Google Drive folder contains spreadsheets with mail processing rates and other statistics, grouped by region and time period. It’s important to note that the percentages are mail processing rates, not delivery rates – mail not processed on time could still get delivered on time. Some more information about this data here.
-
Data is Plural – Structured Archive of all kinds of interesting datasets
-
Farm workers talk to their dairy cows use a lower lexical difficulty of english than mothers talking to their 3¼-year-old children. Science is becoming more and more difficult to understand, and we’ve understood this since this article in Nature from 1992.
-
Lempel-Ziv-Welch compression algorithm, and the Huffman coding algorithm
-
Computer dies during a git operation. Git is upset. See this question.
error: object file .git/objects/31/65329bb680e30595f242b7c4d8406ca63eeab0 is empty fatal: loose object 3165329bb680e30595f242b7c4d8406ca63eeab0 (stored in .git/objects/31/65329bb680e30595f242b7c4d8406ca63eeab0) is corruptFrom the
.gitdirectory, runfind . -type f -empty -delete -printand thengit pull
2020-11-16
- multiplication and its impact (not too much)
/bin/time -vgives extra info like memory usage, stack sizes, sockets used, etc. Somehow this is different thantimeeven thoughwhich timeshows it to be the same 🤔- Nuclear Weapons Journal, Issue 2 of 2005. This is something 12-year old me would have loved.
- How to write a super fast, multithreaded memory allocator using buckets and multiple arenas. Blog post coming soon.
2020-11-15
- “Communism will never work out. There are too many red flags.”
#define NDEBUGto disable asserts in C. Made my own memory allocator almost 40% faster because I had all kinds of asserts sprinkled in there.- Sometimes you’ll need to use
sudo apt-get dist-upgradeto getlinux-headersand other common tools.
2020-11-14
- “Infinite boiling softens the stone”
- How to construct the bebop scale
- For major scales, add the #5
- For minor scales, add the major 3rd
- For dominant 7 scales, add the major 7th
2020-11-13
- This page about the train-launched RT-23 Molodets ICBM. In order to fit in a train cart, this rocket featured an inflatable nose cone. Disguised as refrigerator carts, the trains carrying these ICBMS featured a number of innovations to deflect power wires, eject the rocket without launching, and support the immense weight across multiple carts.
- Weapons and Warfare blog
2020-11-12
- If you try to
mmapa fractional size of a page, it returns the next largest size possible with whole numbers of pages. - How do you write an online algorithm to detect a beat drop in music playing in real time?
- Always assert bounds for array access in C!
2020-11-11
- Static arrays in C must have a size defined not as a variable, like as
#define size 5. Apparently constants are variables. - Are trees aliens?
- Initializing a
pthread_mutex_tusing the macro initializer is fine for static initializations, but if you are doing it afterwards like in a constructor you’ll want to usepthread_mutex_init(&mut, NULL)or else you’ll get an error__pthread_tpp_change_priority: Assertion 'new_prio == -1 || (new_prio >= __sched_fifo_min_prio && new_prio <= __sched_fifo_max_prio)' failed
2020-11-10
- Datawrapper for quickly visualizing data
- Perry Bible Fellowship
- Rough idea how jemalloc works, using the idea of multiple arenas of memory allocation that threads are assigned to
2020-11-09
-
How different waveforms sound
-
Online algorithms are able to provide useful results even with partial data, and results are updated efficiently as more data is available.
-
Imagine a doubly ordered, doubly linked list that has two orderings: ordering
a, whichprev_aandnext_adefine, and orderingb, which is kept track of withprev_bandnext_b. You could use this in keeping track of a free list in a memory allocator, where one ordering is allocations by memory address and the other is by size. This would enable constant time freeing with blocks ordered by memory address, while still letting you use a first-fit allocation strategy on allocating the smallest previously free block on new allocation calls. What is the name for this type of data structure?`typedef struct item{ struct item* prev_a; struct item* next_a;
struct item* prev_b; struct item* next_b; void* data;}`
-
Initialize a
pthread_mutex_twithstatic pthread_mutex_t mut = PTHREAD_MUTEX_INITIALIZER;
2020-11-08
- The size of a struct in C isn’t the sum of the sizes of each of its fields; padding is automatically added to align the struct fields.
2020-11-07
always@(...)in Verilog describes events that should happen under certain conditions. Two common use cases are to have a sensitivity list inside the parenthesis, or to trigger on every clock cycle. Good reference is here.always@(A, B, C)indicates that the assignments inside the block change whenever any of the parameters in the sensitivity list changes – any time A, B, or C changes.always@(posedge clock)updates assignments inside the block at the positive (rising) edge of every clock cycle.
- Amortized time analysis
2020-11-06
- It’s pretty difficult to divide a line into sevenths without practicing. Is there something fundamental about 7 that makes dividing into 7 pieces difficult? Are there aliens for whom it is easy to divide things into 7 pieces, just like humans find it easy to divide things in halves?
- Quantum Computing & Quantum Mechanics courses
2020-11-05
- Pointer arithmetic in C works differently on
void*andstruct*or any other pointer type: when you do+1on a void pointer, that increments the pointer’s address in memory by 1 byte, whereas if you do+1on anint*,char*, orstruct*that increments the pointer by one whole unit, whether that’s an integer, character, or struct.
2020-11-04
- “We are all in the gutter, but some of us are looking at the stars” — Oscar Wilde
- How a computer reboots itself
2020-11-03
-
After committing a super large file in Git, and now you have regrets because it won’t fit in Github and you can’t push it, and now you just want to forget everything you’ve ever had to do with it: (you may have to put the
fflag after-index-filter)git filter-branch --prune-empty -d /dev/shm/scratch \ --index-filter "git rm --cached -f --ignore-unmatch path/to/bigfile.csv" \ --tag-name-filter cat -- --all
2020-11-02
-
“A man who lives fully is prepared to die at any time.” — Mark Twain
-
COVID detection using AI just from cough recordings: looks like a 97.1% accuracy with 100% true negative rate, 16.8% false positive rate.
-
Enable AptX & AAC codec on mac: (may need to disconnect & reconnect headphone afterwards)
sudo defaults write bluetoothaudiod "Enable AptX codec" -bool true sudo defaults write bluetoothaudiod "Enable AAC codec" -bool true -
D-type flip flops implemented using registers in Verilog
-
Akku to monitor bluetooth headphone battery level from mac
-
Spinlocks are useful when you only expect to wait a very short amount of time, because they prevent your thread from being rescheduled. But they are wasteful if you hold them any longer because they’re literally just busy waiting. Also ticket locks and seqlocks are pretty cool.
-
Up until 2019, in Texas it was illegal to buy an Erlenmeyer flask without a permit, in an attempt to prevent illicit drug sales.
-
It’s not too hard to build your own Schlieren imaging setup!
2020-11-01
- Daylight savings in the fall is the better one because you get to sleep an extra hour
- Why my mac would refuse to play music through bluetooth audio. Went into Bluetooth Explorer and clicked Tools ➡ Audio Options ➡ Reset audio default.
2020-10-31
- Refresher on how to use passport.js’s serializeUser, deserializeUser, and local authentication. It’s been a while since I’ve worked with this!
- The off-price retail model (TJX is known for)
- Shibboleth is a cool word
2020-10-30
- Minimum spanning trees and some interesting properties of graph cuts
- Multi-bit wires in verilog
- The story of Hiroo Onada, Japanese soldier tasked with defending to the death an island in the Phillippines against US invasion during WWII. After all his comrades were killed, Onada spent 29 years hiding in the mountains and occasionally murdering civilians and burning crops – nobody ever told him that the war was over, and his last orders were to never surrender or take his own life. There’s a semi-happy ending to this story too.
2020-10-29
- How to write a barrier in C using mutexes and condition variables
- If you can’t think of anything to say, it probably means you aren’t listening closely enough. I’ve found that if I really think about what the other person is saying, there’s always a question I can ask or something related that I can share that moves the conversation forward. When one gets caught up with thinking “what should I say next” it’s easy to fall into the habit of just waiting for one’s turn to speak, rather than engaging in true conversation.
2020-10-28
- How the internet looked in 1985
- Non-demolition quantum measurement is in contrast to the usual projective measurement of a system that leaves it in the measured eigenstate. How can this be done, and what is the state that the system takes on after measurement?
2020-10-27
Promise.anyis in approval! And about time too. Crazy to think that I asked about it 4 years ago in 2016 on StackOverflow – the top voted answer right now has been a pretty neat hack.- You shouldn’t use
mallocwhen creating objects in C++, sincenewtakes care of that for you. Butmallocmight still be useful when paired withrealloc, like for building a dynamically allocated vector, since you can’t do that withnew. - Is general intelligence equivalent to lossless compression? This is a hot take I’ve heard floating around.
- The Efficient Market Hypothesis hypothesizes that stock prices always reflect all knowable data about a company, with the conclusion that there are no such things as undervalued or overvalued stocks. If you believe in this you probably believe it’s impossible to beat the market by picking stocks.
2020-10-26
- How the Bellman-Ford algorithm works
2020-10-25
- propreantepenultimate
- Finally, film simulation recipes for Fujifilm! Recipes for Kodachrome, Ilford HP5, Fujifilm Acros, and more.
2020-10-24
kebab-case- Procedurally generated Chinese landscapes
#pragma onceinstead of include guards! Why did no one tell me about this earlier. Although it’s not universally available in all compilers.
2020-10-23
- Currency arbitrage is the name for that thing
- Great video on RNNs!
- Bongo Cat
- Install MacOS in Virtualbox with this incredible shell script
2020-10-22
- Negative edge weights on graphs could be useful in modeling the free energy of chemical reactions or cost/profit of driving a taxi. Negative edge weights open up the possibility of having negative cycles, where following a cycle ends up with a sum negative weight – this doesn’t really make sense, and the Bellman-Ford algorithm detects these.
2020-10-21
systemctl disable influxdbto prevent a service from starting automatically on boot, effective next stop event (reboot).- Controversy over the Mpemba effect, where hot water freezes faster than cold water (sometimes????)
- Sleep Sort: sort a list by literally doing nothing
- Build nice command line UIs with Go using bubbletea
2020-10-20
- Djikstra’s algorithm
- Basics of Verilog
ctrl-zto suspend a process, andbgandfgto manage processes. Here is how Unix implements them with a job table.- The
cshell,csh, feels more like normal programming than bash
2020-10-19
- Saudade and Solastalgia
2020-10-18
- NVIDIA video codec using AI
- Data lakes in organizations easily suffer from data quality issues when the applications dumping data are not responsible for the quality of their data, the team managing and using the data lake is unable to resolve data quality issues originating upstream.
2020-10-17
- Algorithms for finding strongly connected components of graphs in linear time
- Applying breadth-first search to bipartite coloring
- bat is a cat clone that does syntax highlighting and looks nice
- Fuzzy find files with fzf
- Exa is a cool replacement for
ls, written in Rust
2020-10-16
- Topological sort of a graph in linear time, using discovery and finish times of depth-first search
2020-10-15
- On Unix, pipes run processes concurrently: when you run
echo hi | tail, the shell uses forking to run bothecho hiandtailat the same time, and thestdoutfile descriptor of theechois the same as the file descriptor for thestdinoftail. The two ends of the pipe are in different processes, and link thestdoutof the left hand process to thestdinof the right hand process. This example behaves the same as if I didtail <(echo hi), but this would first runecho hiand then pass that output totail.- This is also the reason why when you do
ps -ef | grep cron, thegrepcommand you are running shows up. It would not show up in the output ofpsifgrepwere running afterpscompleted. But because we are using piping, thegrepprocess is started at the same time, and doing its work on thestdoutofps, which of course will includegrep.
- This is also the reason why when you do
- Put
set follow-fork-mode childandset detach-on-fork offin the gdb window in order to debug forked processes inside the CLion debugger- Note: this doesn’t really work very well but I don’t have the time to figure out why. When a child process exits basically the whole program exits 😟
2020-10-14
- Minterms
- Somehow disabling 3d acceleration in VirtualBox for a Ubuntu 20.04 vm fixes problems with the UI being incredibly laggy
- How to use
execlp, whose man page documentation is incredibly vague
2020-10-13
- The inventor of the theremin, Leo Theremin, also happened to invent a bugging device concealed within a gift given by the Soviet Union to the US Ambassador’s house in Moscow.
- Clara Rockmore, who plays the theremin
- From September 19 until today, I have been writing dates on this page as 2019 instead of 2020 🙃 Thanks to Kirpal who told me about this!
2020-10-12
-
About one third of press releases are exaggerated, and these get magnified in news stories. Exact results here, go take a look.
-
Uninstall all adobe junk applications and processes with CC Cleaner
-
News embargoes mean that science reporters can only report in the ways that publishers like the FDA allow. Embargoed news has been around since the 1920s, when it meant that science journals would offer reporters early access to papers and contact information of authors, under the condition that the reporters can only publish their story after the embargo time period expires. This would enable reporters extra time to research their story, without the fear that their story would get published by someone else first.
The close-hold embargo forbids reporters from contacting outside sources for commentary about news. This essentially prevents all independent reporting, allowing the journal or organization to dictate what the news says. The FDA has a history of doing this.
2020-10-11
- Cookies are passé. Browser fingerprinting is à la mode. Check if your browser is leaking your fingerprint at Panopticlick, a project by the EFF.
- I should read Gödel, Escher, Bach
2020-10-10
mongodumpandmongorestorehave a-gzipflag to zip dumpedbsondocuments- The story behind Aaj Shanibar
- Glyptodonts used to roam prehistoric Earth until probably the end of the ice age
- “The object of art is not to reproduce reality, but to create a reality of the same intensity.” ーAlberto Giacometti
2020-10-09
- Difference between
aptandapt-get - How to resize a virtualbox disk image using
gparted - What “DAO” means (somehow I’ve never seen someone call it that before)
- Saol is an awesome font
2020-10-08
- How to move from one key to another using common chords
2020-10-07
- How to play tones through a speaker connected to a GPIO pin.
- How would you play music, chords, or multiple tones at once?
2020-10-06
- Neat-URL removes trackers from your URLs
- Boop to easily do text things! Lots of useful and fun shortcuts. Hard to describe but pretty awesome.
- QuickJS is a JavaScript runtime that starts much faster than the v8 engine used in Node.js. Could be useful for serverlessor CLI apps that need to start and stop very quickly. Elsa is a QuickJS wrapper written in Go.
- DUF (Disk Usage Free) utility
- Herbie Hancock gave lectures at Harvard!
2020-10-05
- C order of operations in type declarations
2020-10-04
- Windcatchers are an ancient and effective way to ventilate and cool a large space, and are still great techniques to use today. Yakhchāls are related and also pretty cool.
- Gnome sort is an easy in-place sorting algorithm
2020-10-03
- Put commands in
/etc/rc.localto have them run every time the system boots! Using the@rebootdescriptor in your crontab doesn’t always work, depending on the system-specific implementation of cron (it didn’t on the Intel DE1-SoC board’s distribution of Linux). - Use
cronto schedule recurring tasks, useanacronto schedule recurring tasks on machines that aren’t powered on all the time. Any tasks that were missed while the computer was off, will be run when it turns on again withanacron. - Rectangle for a super clean way to manage window tiling on MacOS
2020-10-02
- Handy guide to printf formatting
2020-10-01
- Linear probing for hashtables
- Paper about the effects of ventilation on indoor spread of COVID-19. Many common ventilation approaches actually increase the risk of COVID-19 exposure indoors.
2020-09-30
- Survey of Waterloo software engineering majors on all sorts of topics, ranging from salary to personal habits. (over 100 pages long!)
:set keywordprg=cppmanin vim gives you access to C++ function documentation when you pressKover a function name- Shigeo Sekito, a Japanese electone player whose song “ザ・ワード II” was sampled in Travis Scott and Quavo’s song “How U Feel”. Sekito’s enigmatic and diverse body of works seem to be heavily influenced by jazz, blues, bop, funk, and even a bit of electronica emerging at the time. You can hear his style progress and develop, especially in his 1985 album アーティスティック・エレクトーン. I absolutely love his sound, and especially the title song – and the album just gets better.
2020-09-29
- Algorithms for finding the majority element of a list in linear time
- Academictree.org for family trees of people in academia
- When to use the harmonic mean
- Pipeline pigs 🐷
2020-09-28
- Darwinism suggests that human altruism may have evolved in a way such that groups of early humans who demonstrated more altruism, were more likely to survive in violent conflicts against other groups with less altruistic traits. This study suggests that violence among early humans played a significant role in shaping the social dynamics of groups during the hunter-gatherer time period.
- Everything We Eat Both Causes And Prevents Cancer
2020-09-27
- Purpleair has a JSON API
- Send SMS free, alternative to Twilio
- Detect news articles that have corporate sponsors with this chrome extension
- Wildfires have burned 3.1 million acres in California so far this year. And fire season isn’t even fully upon us.
- Spin cleanup for quantum phase estimation
- 👉 The Missing Semester Of Your CS Education
2020-09-26
- Github refuses to use KaTex with Jekyll, switched over to just mathjax.
- Installing mongodb on macOS Catalina with SIP means you have to change the data directory by
mongod --dbpath=/Users/<your_username>/data/db - Sigterm vs sigkill and C++ signal handling
2020-09-25
- How to solve the closest pair problem in O(nlog(n)) time
- Cool bit twiddling tricks and crazy bit manipulations
- Classes and inheritance in C++
- Use the
titleattribute instead of#h1in this file to make sure the title doesn’t appear twice. Weird things happen when you use the#h1thing.
2020-09-24
- How to use malloc in assembly
- Imposter syndrome (I might have it?)
2020-09-23
- How memory mapped IO works
2020-09-22
- How the median of medians algorithm works to produce the approximate median in (O(n)) time
- How to write a news article about a scientific paper 🙃
- Quagga
- After you add an ssh key to Github, you need to use the ssh url to clone the repo in order to use your ssh credentials.
2020-09-21
- How to use partially observable markov decision processes (POMDP) to efficiently search for items on a desk using a robotic manipulator, when some items obscure others. While solving for full solutions for a POMPD requires an (O(n^2)) solution, using Monte-Carlo sampling can cut this time down dramatically, enabling this paper to be able to plan movements of the robotic manipulator in real time.
- In that paper, they use a POMDP by defining:
- Set of world states (the objects on the table)
- Set of actions (moving an object, moving the robot camera location/angle)
- Set of observations (using R-CNN model to recognize bounding boxes for objects on the table)
- State transition function, defining the probability distribution of new states after taking some action (moving an item) under the current state
- Observation function, defining the probability distribution of possible observations (arrangements of obscured objects) given the resulting state and an action. Follows from the state transition function.
- Reward function, giving a valued-reward for taking certain actions like finding the correct item.
2020-09-20
- How to play Among Us
- Lilly impellers
2020-09-19
- Karatsuba’s algorithm for fast multiplication
2020-09-17
- Pointer arithmetic for array access in C++
- How to get Outlook to not delete event invitations after you accept them (it’s in settings, under Settings => Calendar => Events and invitations => Delete invitations and responses…)
2020-09-16
- Using the stack and safe registers in assembly
- The Line: a short story by Amor Towles, the author of one of my recent favorite books, A Gentleman in Moscow.
2020-09-15
- How to use GDB for debugging assembly programs
- You will segfault if you call
printfon a format string with the wrong specifiers :(
2020-09-14
- The difference between function calls and labels in assembly
- SSH port forwarding from Virtualbox to host
2020-09-13
- Stoicism and Seneca (added to my reading list)
- The independent set problem and some applications to things like interval scheduling and bipartite matching
- What my would-be-roomates’ dorm in Boston looks like (it’s nice!)
2020-09-12
- How to play codenames
- Silq is a cool and hip high level quantum programming language which has the unique feature of automatic uncomputation
- NORMALIZE PROGRAMMING WITH EXPLICIT PRECONDITIONS AND POSTCONDITIONS!!!
2020-09-11
- What a disjoint union is
- The basics of lambda calculus
- How we can interpret quantum circuits as higher order functions (!!!)
- How to add LaTeX equations to this blog so that you can see the lovely next bullet
- One can think of quantum state teleportation as (g(f(\vert\phi\rangle)) = \vert\phi\rangle), and its inverse of teleporting classical bits, as (f(g(x, y)) = (x,y)) when (f:qbit \rightarrow bit; \otimes; bit), (g:bit;\otimes;bit \rightarrow qbit). (f) is located at the sender, while (g) is located at the receiver (in state teleportation). Beautiful.
2020-09-10
- Checkpointing and restart versus Kubernetes’s approach to drain a node
- Mainframes still exist (!) and are still used today when huge amounts of memory needs to be accessed by huge amounts of processors, and for high throughput applications
- “The computer is the tool, computation is the principle.” (I kinda already knew this but this is a nice way of saying it)
- “There are at least two kinds of games. One could be called finite, the other, infinite. A finite game is played for the purpose of winning, an infinite game for the purpose of continuing the play.” (Finite and Infinite Games, Ballantine, 1986, p. 1.)
2020-09-09
- Who the AI research faculty are at Northeastern, what are the labs, and what they work on
- Living in a red haze all day from the wildfire smoke really messes with how you perceive time. I felt exactly like I feel at hackathons, since the luminosity of my room did not change from morning to evening.
2020-09-08
- Lambda calculus for quantum computers is insane and I need to learn more. Somehow I’ve managed to not hear about this before. It seems like an area orthogonal to the gate model and that is going to be super important once the hardware of quantum computing is ironed out.
- SecDB is a thing. More, I cannot really say
2020-09-07
- Dewey Square by Charlie Parker, on saxophone
2020-09-06
- Surprising effect when you use both L2 Regularization and Batch Norm together
2020-09-05
- This startup building an AI friend/therapist/romantic partner, and a great podcast about it
2020-09-03
- How to set up a custom message to greet people on your SSH server
2020-09-02
- “Your assumptions are your windows on the world. Scrub them off every once in a while, or the light won’t come in.” - Isaac Asimov
- Foothill College ran a course on quantum computing. Here is the book, and here are the lectures.
- The right packages to remove to transform a desktop linux image into a headless server
2020-09-01
- More of Dewey Square
- Up until 1820, China was the world’s largest economy, accounting for almost 33% of the world’s GDP at the time (source).
2020-08-31
- The Raspberry Pi Zero is tinier than you expect and cuter than you expect
- How to play the first page of Dewey Square by Charlie Parker on the saxophone
2020-08-30
- How to use Go modules
- How to set up a compressed Docker image from a Go project
- I should look into Tilt for building Kubernetes apps