Skip to content

Instantly share code, notes, and snippets.

@naddeoa
naddeoa / network-test.sh
Last active January 5, 2022 20:18
mtr script to gather information about your laggy network connection so you can try to convince your ISP there actually is a problem
#!/bin/bash
# When you're done, make a copy of this spreadsheet and paste report-filtered.csv into it to
# use the pivot tables to graph it out. The date column auto populates. Press ctrl+c to kill the script.
# https://docs.google.com/spreadsheets/d/117cP-euvlTeEcQ261R89BnGHLuszvWlF37Uyw8hgCHU/edit?usp=sharing
handler()
{
echo
}
@naddeoa
naddeoa / .vimrc
Last active March 2, 2021 20:21
Tagbar definition for vim .notes files using markdown2ctags python script
let g:tagbar_type_notes = {
\ 'ctagstype': 'notes',
\ 'ctagsbin' : '~/files/bin/markdown2ctags',
\ 'ctagsargs' : '-f - --sort=yes --sro=\|',
\ 'kinds' : [
\ 's:sections',
\ 'i:images'
\ ],
\ 'sro' : '\|',
\ 'kind2scope' : {
@naddeoa
naddeoa / .vimrc
Created May 17, 2020 21:07
Copy from vim into system clipboard on windows subsystem for linux
" Kind of hacky but it works. This just copies stuff to a file to cat it into the windows clipboard and then
" deletes the file so that you don't have anything risky laying around in there.
" fake copy current line or selection
noremap YY "yyy \| :call writefile( getreg('y', 1, 1), $HOME.'/.vimbuffer') \| :!cat $HOME/.vimbuffer \| clip.exe <CR> \| :!rm $HOME/.vimbuffer<CR>
" fake copy entire file
noremap <C-a> :%y y \| :call writefile( getreg('y', 1, 1), $HOME.'/.vimbuffer') \| :!cat $HOME/.vimbuffer \| clip.exe <CR> \| :!rm $HOME/.vimbuffer<CR>
@naddeoa
naddeoa / python-ml-setup.mk
Last active April 28, 2019 21:30
Python ML project setup
# Logic above in make form. Run with `make init`
project.name := project-name
freeze.txt := requirements.txt
notebook.dir := notebooks
data.dir := data
src.dir := src
.PHONY: init dependencies reinstall
init: $(project.name)

Worksheet for session 3

TBD

Worksheet for session 2

We left off with 2 known bugs in the implementation of the todo list. Try to find out what's causing them and fix them.

  • How can I avoid running the getFilteredTodoItems() twice? We know its not very efficient.
  • Fix that persisting bug. You'll notice that if you hit enter to add a todo item and them immedietly reload the page that it won't load back up in the right state.

Next Stream

We had someone suggest learning Angular. I'm inclined to stick with React for another session or two so we get a bit more value out of what we've done so far. I'm leaning towards making a backend for the todo storage.

Worksheet for session 1

  • Follow up on the first worksheet and try to close the gap between what we built and the actual website sample.
  • Make the list persist across page loads

If you get all of that done then you can try this as well.

  • Try a calculator app next. That will be an independent project and it should be a good excuse to struggle a bit alone so that you generate some questions for next time. The stream part is definitely good but it it's still a supplement for normal independent work.
  • Start by prototyping the html
@naddeoa
naddeoa / reddit coding exp session 0.md
Last active February 10, 2019 04:31
Worksheet for the Reddit Coding Experiment, Session 0

Worksheet for session 0

All of this will be inside of the Ubuntu VM that I created before the session. See https://naddeo.org/2019/02/reddit-coding-experiment.html for setup instructions.

Open a Terminal by clicking the black icon in the vertical side menu.

# Install node/npm LTS. We'll do this together.

# Add npm/node to the path
@naddeoa
naddeoa / InputStreamUtil.kt
Created November 26, 2018 00:50
Copy input stream in Kotlin with progress
import java.io.InputStream
import java.io.OutputStream
fun InputStream.copyTo(out: OutputStream, onCopy: (totalBytesCopied: Long, bytesJustCopied: Int) -> Any): Long {
var bytesCopied: Long = 0
val buffer = ByteArray(DEFAULT_BUFFER_SIZE)
var bytes = read(buffer)
while (bytes >= 0) {
out.write(buffer, 0, bytes)
bytesCopied += bytes
@naddeoa
naddeoa / Makefile
Created November 5, 2018 20:49
Using a Makefile to build TypeScript and React Native
workspace.dir := $(PWD)
workspace.node_modules := $(workspace.dir)/node_modules
typescript.src.dir := $(workspace.dir)/src
typescript.src.ts := $(shell find $(typescript.src.dir) -name '*.ts' -type f)
typescript.src.tsx := $(shell find $(typescript.src.dir) -name '*.tsx' -type f)
typescript.src.files := $(typescript.src.ts) $(typescript.src.tsx)
typescript.build.dir := $(workspace.dir)/artifacts
typescript.build.ts := $(patsubst $(typescript.src.dir)%.ts,$(typescript.build.dir)%.js, $(filter %.ts,$(typescript.src.files)))