Skip to content

Instantly share code, notes, and snippets.

View ndarville's full-sized avatar

N. Darville ndarville

  • Europe
View GitHub Profile
@ndarville
ndarville / README.md
Last active April 7, 2024 04:01
From CSV to HTML table (Simple)

This code generates an HTML table based from a CSV file. This is from the tutorial by Christophe Viau.

In trying his code example, I discovered that the code doesn't work as-is, so I figured others might like to see a working d3.js example that did not rely on a pre-existing container HTML element.

The code remains the same except for some cosmetic tweaks.

The task of writing the CSS is left as an exercise for the reader.

@ndarville
ndarville / diff.mdown
Created July 23, 2012 20:33
Paul Heckel's Diff Algorithm

[Isolating Differences Between Files][paper]

Advantage over Other Algorithms

The diff output is more specific:

[I]f a whole block of text is moved, then all of it, rather than just the beginning and end, is detected as changed.

>The algorithm described here avoids these difficulties. It detects differences that correspond very closely to our intuitive notion of difference.

@ndarville
ndarville / business-models.md
Last active January 13, 2024 17:27
Business models based on the compiled list at http://news.ycombinator.com/item?id=4924647. I find the link very hard to browse, so I made a simple version in Markdown instead.

Business Models

Advertising

Models Examples
Display ads Yahoo!
Search ads Google
@ndarville
ndarville / webm.md
Last active September 30, 2023 18:56
4chan’s guide to converting GIF to WebM - https://boards.4chan.org/g/res/41212767

Grab ffmpeg from https://www.ffmpeg.org/download.html

It's a command line tool which means you will have to type things with your keyboard instead of clicking on buttons.

The most trivial operation would be converting gifs:

ffmpeg -i your_gif.gif -c:v libvpx -crf 12 -b:v 500K output.webm
  • -crf values can go from 4 to 63. Lower values mean better quality.
  • -b:v is the maximum allowed bitrate. Higher means better quality.
@ndarville
ndarville / README.md
Last active September 21, 2023 21:34
How to export and rehost your Tumblr site

How to export and rehost your Tumblr site

(Update: Version 3.2.0 of Jekyll looks like it's breaking a few things, so I've changed the guide to make you specifically install the version I was using, 3.1.3. I believe this is the issue: jekyll/jekyll#5145.)

You will be using jekyll-import to export your Tumblr site, Jekyll to (re)create it, and Surge to rehost it.

Update: You can also use Tumblr's native export feature in your blogs' individual settings. But rehosting that might be tricky. Read my comments below this post for how that works.

Setup and installation

@ndarville
ndarville / secret-key-gen.py
Created August 24, 2012 17:01
Generating a properly secure SECRET_KEY in Django
"""
Two things are wrong with Django's default `SECRET_KEY` system:
1. It is not random but pseudo-random
2. It saves and displays the SECRET_KEY in `settings.py`
This snippet
1. uses `SystemRandom()` instead to generate a random key
2. saves a local `secret.txt`
@ndarville
ndarville / asciichart.mdown
Last active March 2, 2022 15:59
Envisioning ASCII bar charts
@ndarville
ndarville / startup.bat
Last active June 24, 2020 14:09
Batch script to delay startup of applications after boot
@echo off
timeout /t 120
start itunes
start /min %APPDATA%\Dropbox\bin\Dropbox.exe
start /min "" "C:\Program Files (x86)\Battle.net\Battle.net"
start /min "" "%LOCALAPPDATA%\Discord\app-0.0.297\Discord.exe"
@ndarville
ndarville / README.md
Last active May 18, 2020 05:21
Confidence Interval

(This chart is a part of the d3-charts collection available [here][collection].)


This chart displays the share of votes over time between two Danish parliamentary coalitions using placeholder data. The chart here has been used for two coalitions, but can also be used for two candidates.

You will notice something enveloping the line charts, which is the [confidence interval][ci], which indicates the spectrum of the confidence in our displayed results---to use a completely unscientific definition.

Compare this to [Sam Wang's chart for the U.S. 2012 election][wang] and [Drew Linzer's charts for individual states][votamatic].

@ndarville
ndarville / settings.py
Last active April 13, 2020 08:18
Django on Travis CI
"""A basic database set-up for Travis CI.
The set-up uses the 'TRAVIS' (== True) environment variable on Travis
to detect the session, and changes the default database accordingly.
Be mindful of where you place this code, as you may accidentally
assign the default database to another configuration later in your code.
"""
import os