Skip to content

Instantly share code, notes, and snippets.

@FLamparski
FLamparski / dna.txt
Created October 12, 2016 17:36
evolving towards ken bone
3 1000 232 5 2 0.9356521479540434 111 170 17 188 63 197 201 154 227 0.13464087134528213 7 184 174 86 191 67 182 73 215 0.2194653171728026 84 47 71 78 151 106 242 179 97 0.001 108 78 154 168 57 93 146 116 63 0.001 145 8 88 87 106 22 239 139 119 0.5865357490610987 197 106 191 32 147 30 253 53 109 0.5205563096431599 116 75 98 200 49 182 134 69 46 0.001 145 111 148 152 155 150 252 2 181 0.9968319506177736 6 2 0 187 118 141 177 204 198 0.001 36 84 125 112 58 58 149 1 126 0.9999882310628767 194 0 0 2 8 192 4 2 229 0.9659037288383411 197 198 200 0 128 19 120 1 237 0.9928429808717291 198 199 200 23 126 49 133 2 245 0.9918611477500882 38 194 0 0 196 1 238 4 217 0.04750376251015209 101 139 12 188 103 196 48 72 123 0.001 114 36 96 53 160 122 98 218 75 0.001 29 126 191 137 127 183 20 184 132 0.001 187 30 179 60 86 188 21 1 68 0.9677728118246786 200 199 200 0 6 24 148 214 48 0.9625386140412341 192 13 68 151 50 90 243 76 173 0.001 54 185 97 181 97 70 59 254 84 0.001 27 28 125 87 154 193 59 3 26 0.7728665120767301 198 6 189
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>DOM performance test</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
@FLamparski
FLamparski / logger.js
Created September 9, 2016 10:24
Console logging for any site
(function () {
document.body.innerHTML += '<div id="log"></div>';
document.head.innerHTML += '<style>#log{position:fixed;bottom:0;right:0;left:0;height:150px;font:12px monospace;background-color:rgba(0,0,0,.6);color:#eee;overflow-y:auto}#log .log-message .log-ts{opacity:.6}#log .log-message.severity-info{background-color:#add8e6;color:#fff}#log .log-message.severity-warn{background-color:#ff0;color:#222}#log .log-message.severity-error{background-color:pink;color:#e00}</style>';
if (!console) {
console = {};
}
var old = console.log;
var logger = document.getElementById('log');
console.log = function (message) {
if (typeof message == 'object') {
@FLamparski
FLamparski / mwcleanerfromhell.ipynb
Created August 14, 2016 19:20
A function that tries to convert a Wikipedia article to plain text using mwparserfromhell.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@FLamparski
FLamparski / WikiWordFrequency.ipynb
Last active August 13, 2016 13:15
One of the many ways to get word counts in wiki articles
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@FLamparski
FLamparski / README.markdown
Created July 4, 2016 20:08
Learning Elixir: A shitty program that does things with data

Crapitals

Filip Learns Elixir, Day 1

Basically, it's a thing which reads data from a CSV file, keeps it in memory using a stateful process CountryList, and lets you query said list. I tried using several of Elixir's features here such as processes, messaging, pattern-matching, and the pipe operator.

@FLamparski
FLamparski / index.html
Created June 22, 2016 13:40
Checking for existence of a property (https://jsbench.github.io/#eeccc7f9e560816ad321234e1deab0ea) #jsbench #jsperf
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Checking for existence of a property</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
@FLamparski
FLamparski / index.html
Created June 22, 2016 09:08
Comparing methods to create a Moment object (https://jsbench.github.io/#bae40c8c11c78668b0f2ae9a6caae025) #jsbench #jsperf
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Comparing methods to create a Moment object</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
@FLamparski
FLamparski / queue.js
Created June 13, 2016 11:28
A rate-limiting queue for promised jobs
const _ = require('lodash')
/**
* A rate-limiting queue for functions that return promises.
*
* const q = new Queue({rate: 1000})
* Promise.all(_.range(10).map(n => q.push(() => n * n))).then(all => console.log(all))
* q.start()
* // ten seconds later => [ 0, 1, 4, 9, 16, 25, 36, 49, 64, 81 ]
*
@FLamparski
FLamparski / README.md
Created March 27, 2016 18:41
Messing about with context-free generative grammars in Python

I'm messing about with generative context-free grammars in Python. The generator itself is in gen_grammar.py, and the test grammar used is in grammar.json.

Program usage

$ ./gen_grammar.py grammar.json will generate a single sentence from the given grammar.

Grammar format