Skip to content

Instantly share code, notes, and snippets.

@allisonking
allisonking / README.md
Created January 28, 2020 03:20
Various scripts for working with markdown chapters

These are a few scripts I've used to help me out while writing a novel where each chapter is a markdown file. A repo might have a format like this:

book/
├── part-1
│   ├── chapter-01.md
│   ├── chapter-02.md
│   ├── chapter-03.md
│   ├── chapter-04.md
│ ├── chapter-05.md
@allisonking
allisonking / .block
Last active January 22, 2023 08:36
Real time visualization of Ethereum prices using Websockets
scrolling: yes
@allisonking
allisonking / README.md
Last active November 6, 2017 02:19
bash script for tracking progress during nanowrimo

Purpose

I wrote this script* to easily calculate if I was on track for NaNoWriMo and to automatically generate commit messages based on my progress.

This script does two things:

  • Reports how close the user is to the word count for the day
  • If cm is passed as an argument, it will git add, commit, and push to a repository with a message that records the current word count and which day of the month it is

This has only been tested in Ubuntu

Running

@allisonking
allisonking / .block
Last active January 8, 2020 22:27
Tufte slopegraph with different data sets
scrolling: yes
@allisonking
allisonking / README.md
Last active September 20, 2017 00:41
d3 word cloud with text hover

This uses Jason Davies' word cloud library library to render the 100 most popular words in titles of fan fiction that are tagged as being about Sirius Black and Remus Lupin. Hover over a word to see randomly chosen titles that have that word in them.

@allisonking
allisonking / README.md
Last active April 20, 2021 00:01
Harry Potter fan fiction cooccurrence matrix

This is a cooccurrence matrix based off of Les Miserables Co-occurrence only with Harry Potter characters, where cooccurrence is defined as if two characters are tagged as characters featured in a given fan fiction. Therefore the diagonal values are all the same, since every fan fiction that has Albus Dumbledore also has Albus Dumbledore.

Instead of the intersecting values being the number of fan fictions between two characters, the number is normalized by dividing by the number of total fan fictions about that character. Therefore, the value in [Draco Malfoy][Harry Potter] is most likely not the same as [Harry Potter][Draco Malfoy]. This allows us to see some interesting properties- for example, of all Lupin fan fictions, 16.23% also feature Tonks. However, of Tonks fan fictions, 70.57% also feature Lupin. This shows perhaps a conflict in the fandom of who else Lupin is spending a lot of time with in fan fiction... WolfStar, anyone?

@allisonking
allisonking / README.md
Last active September 13, 2017 14:30
Bar graph by gender- Harry Potter canon vs. fan fiction

This is the same chart as this one except the colors represent the character's gender instead of their relative popularity. Red represents a male character, gold a female character, and grey other.

@allisonking
allisonking / README.md
Last active September 13, 2017 02:40
Bar graph with object constancy- Harry Potter canon vs. fan fiction

Simple bar graph with object constancy that tracks either:

  • how many times a character is mentioned in the seven Harry Potter books (data from here)
  • how many times a character is tagged in fan fiction as being one of the main characters

This dataset was normalized by dividing by the total number out of the top 200 characters. So if there were a total of 20 fan fictions tagged as Sirius Black, and there were a total of 100 fan fictions, Sirius Black fan fictions would show up as 20%. Note that therefore this percentage will add up to be over 100% since fan fictions can tag multiple characters. For example, if our total fan fictions were made entirely out of fan fictions tagged Sirius Black and Remus Lupin, it would be correct to say that 100% of fan fictions are about Sirius Black and 100% of fan fictions are about Remus Lupin.

This is a somewhat reusable graph- see [this block](https://bl.ocks.org/allisonking/158e96

@allisonking
allisonking / .block
Last active December 5, 2018 20:14
Zoomable, pannable, scatterplot with timeline and fontawesome
scrolling: yes
@allisonking
allisonking / README.md
Last active August 1, 2020 18:43
Using saved points from a force directed graph

This is part two of using d3.js's force directed graph to create a customized static layout. Part 1 is here. The file character_nodes.json was the result of moving each node and Bezier control point around until the graph looked reasonable, then printing it out as described in part 1.