Skip to content

Instantly share code, notes, and snippets.

View lmmx's full-sized avatar
💡
lights, camera, action

Louis Maddox lmmx

💡
lights, camera, action
View GitHub Profile
@shawwn
shawwn / since2010.md
Created May 11, 2021 09:46
"What happened after 2010?"

This was a response to a Hacker News comment asking me what I've been up to since 2010. I'm posting it here since HN rejects it with "that comment is too long." I suppose that's fair, since this ended up being something of an autobiography.

--

What happened after 2010?

@skoba
skoba / covid19.py
Last active March 15, 2020 17:54
COVID-19 simuation by SEIR model
# The preprints is available from https://www.preprints.org/manuscript/202002.0179/v1
# S Susceptible
# E Exposed
# I Infected
# R Recovery
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
r0 = 3. # basic reproduction number
// gif by dave @beesandbombs
int[][] result;
float t, c;
float ease(float p) {
return 3*p*p - 2*p*p*p;
}
float ease(float p, float g) {
// post a message to Slack when a file is added to an S3 bucket
'use strict';
console.log('Loading function');
const aws = require('aws-sdk');
const https = require('https');
const s3 = new aws.S3({ apiVersion: '2006-03-01' });
@mikekasprzak
mikekasprzak / chromium.sh
Last active October 16, 2016 18:45
Gets the latest version of Chromium, and installs it in the current directory
#!/bin/bash
# chromium.sh - Runs the currently installed version of Chromium, without setuid, and in a different settings folder
.chromium-linux/chrome --user-data-dir=~/.config/chromium-canary --disable-setuid-sandbox &
@karpathy
karpathy / min-char-rnn.py
Last active December 20, 2024 19:43
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
%%file _chi2.c
#include <Python.h>
#include <numpy/arrayobject.h>
#include "chi2.h"
static char module_docstring[] =
"This module provides an interface for calculating chi-squared using C.";
static char chi2_docstring[] =
"Calculate the chi-squared of some data given a model.";
@timelyportfolio
timelyportfolio / Readme.md
Last active August 29, 2015 14:10
Animated Christmas SVG in R with htmltools + rvest + XML & vivus.js
@jennybc
jennybc / 2014-10-12_stop-working-directory-insanity.md
Last active September 23, 2022 04:43
Stop the working directory insanity

There are packages for this now!

2017-08-03: Since I wrote this in 2014, the universe, specifically Kirill Müller (https://github.com/krlmlr), has provided better solutions to this problem. I now recommend that you use one of these two packages:

  • rprojroot: This is the main package with functions to help you express paths in a way that will "just work" when developing interactively in an RStudio Project and when you render your file.
  • here: A lightweight wrapper around rprojroot that anticipates the most likely scenario: you want to write paths relative to the top-level directory, defined as an RStudio project or Git repo. TRY THIS FIRST.

I love these packages so much I wrote an ode to here.

I use these packages now instead of what I describe below. I'll leave this gist up for historical interest. 😆

@danieleds
danieleds / gist:326903084a196055a7c3
Created September 4, 2014 08:48
CodeMirror: indent with tab or spaces
editor.addKeyMap({
"Tab": function (cm) {
if (cm.somethingSelected()) {
var sel = editor.getSelection("\n");
// Indent only if there are multiple lines selected, or if the selection spans a full line
if (sel.length > 0 && (sel.indexOf("\n") > -1 || sel.length === cm.getLine(cm.getCursor().line).length)) {
cm.indentSelection("add");
return;
}
}