
View elixir-node-latency.iex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
iex(foo@10.12.165.73)29> Node.list |> Enum.map(fn node -> Enum.map(1..100, fn _ -> {us, :pong} = :timer.tc(Node, :ping, [node]) | |
...(foo@10.12.165.73)29> us/2 end)|> Enum.reduce(fn x, sum -> sum + x end) end) |> Enum.map(fn x -> x / 100 end) | |
[413.585, 436.995] |
View worstresignations.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import chess | |
import chess.pgn | |
import chess.engine | |
from chess import BLACK, WHITE | |
engine = chess.engine.SimpleEngine.popen_uci("./stockfish_20090216_x64_avx2") | |
import bz2 | |
path = "lichess_db_standard_rated_2017-04.pgn.bz2" | |
f = bz2.open(path, "rt", encoding="ascii") |
View foo.ex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Foo do | |
def bar(first_day, second_day) do | |
days_between = Date.diff(second_day, first_day) + 1 | |
dow1 = Date.day_of_week(second_day) | |
dow2 = Date.day_of_week(second_day) | |
weekend_days = | |
Kernel.floor((days_between + dow2) / 7 * 2) + | |
if(dow1 == 7, do: 1, else: 0) - if(dow2 == 6, do: 1, else: 0) |
View fix-svg.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// complete list of camelCase attributes | |
// https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute | |
const camelAttributes = [ | |
'allowReorder', 'attributeName', 'attributeType', 'autoReverse', | |
'baseFrequency', 'baseProfile', 'calcMode', 'clipPathUnits', 'contentScriptType', | |
'contentStyleType', 'diffuseConstant', 'edgeMode', 'externalResourcesRequired', | |
'filterRes', 'filterUnits', 'glyphRef', 'gradientTransform', 'gradientUnits', | |
'kernelMatrix', 'kernelUnitLength', 'keyPoints', 'keySplines', 'keyTimes', 'lengthAdjust', | |
'limitingConeAngle', 'markerHeight', 'markerUnits', 'markerWidth', 'maskContentUnits', | |
'maskUnits', 'numOctaves', 'pathLength', 'patternContentUnits', 'patternTransform', |
View how-to-make-a-racist-ai-without-really-trying.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View example.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fixNewLine = require('./index.js') | |
const remark = require('remark') | |
text = "lol\nlol\n```\nlol\nlol\n```\n> lol\n> lol" | |
processed = remark() | |
.use(fixNewLine) | |
.processSync(text) | |
console.log(processed) |
View Untitled.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View paste-in-console.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
var preTags = document.getElementsByTagName('pre'); | |
var preWithHeaderInfo = preTags[0]; | |
var preWithContent = preTags[2]; | |
var lines = preWithContent.textContent.split('\n'); | |
// get data about the formatting (changes between different versions of chrome) | |
var rgx = /^(0{8}:\s+)([0-9a-f]{2}\s+)[0-9a-f]{2}/m; | |
var match = rgx.exec(lines[0]); |
View feederer-sample-result.ex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
feed: [ | |
publisher: "webmaster@example.com", | |
updated: "Tue, 10 Jun 2003 09:41:01 GMT", | |
published_parsed: "Tue, 10 Jun 2003 04:00:00", | |
subtitle: "Liftoff to Space Exploration.", | |
language: "en-us", | |
links: [ | |
[ | |
href: "http://liftoff.msfc.nasa.gov/", type: "text/html", |
NewerOlder