Skip to content

Instantly share code, notes, and snippets.

View jorpic's full-sized avatar

Max Taldykin jorpic

  • Formal Methods
  • In transit
View GitHub Profile
@jorpic
jorpic / gist:3907805
Created October 17, 2012 20:04
data parser
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances #-}
{-# LANGUAGE OverlappingInstances #-}
import Data.Attoparsec.Text as P
import Data.Text (Text)
import Control.Applicative
data A = A {a1 :: Int, a2 :: Text}
@jorpic
jorpic / index.html
Last active August 29, 2015 14:01
конформизм
<!DOCTYPE html>
<!-- По мотивам http://macroevolution.livejournal.com/168362.html -->
<meta charset="utf-8">
<style>
</style>
<body>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="http://coffeescript.org/extras/coffee-script.js"></script>
<script src="http://underscorejs.org/underscore-min.js"></script>
<script type="text/coffeescript">
@jorpic
jorpic / index.html
Last active August 29, 2015 14:02
d3.js spiral
<!DOCTYPE html>
<body>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="http://underscorejs.org/underscore-min.js"></script>
<script src="http://coffeescript.org/extras/coffee-script.js"></script>
<script type="text/coffeescript">
x = 1
data = _.map([1..36], -> x *= 0.892)
squares = d3.select('body').append('svg')
@jorpic
jorpic / pigeonhole.v
Last active August 29, 2015 14:05
constructive pigeonhole proof
Require Import Omega.
Require Import Coq.Arith.Peano_dec. (* eq_nat_dec *)
Lemma nex_to_forall : forall k n x : nat, forall f,
(~exists k, k < n /\ f k = x) -> k < n -> f k <> x.
Proof.
intros k n x f H_nex H_P H_Q.
apply H_nex; exists k; auto.
Qed.
@jorpic
jorpic / plot.py
Created September 14, 2014 18:59
CNF shuffling
#!/usr/bin/env python
import sys
import re
import matplotlib.pyplot as plt
import matplotlib.cm as cm
from numpy import array
from matplotlib import animation
data = {}
@jorpic
jorpic / scan-hackage.sh
Last active May 25, 2017 03:03
Count FlexibleContexts usage on hackage
#!/bin/bash
ROOT=http://hackage.haskell.org
PACKAGES=`curl -s http://hackage.haskell.org/packages/ \
| sed 's/href/\n/g' \
| grep -o '/package/[^"]*'`
echo Total number of packages
echo $PACKAGES | wc -w
@jorpic
jorpic / index.html
Last active August 29, 2015 14:11
d3.js spinner
<!DOCTYPE html>
<html>
<style>
html, body {
margin: 0;
color: #444;
}
#spinner {
display: none;
text-align: center;
@jorpic
jorpic / index.html
Last active January 5, 2016 12:25
Weather in Moscow
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<link href="http://fonts.googleapis.com/css?family=Raleway:400,300,600" rel="stylesheet" type="text/css">
<style>
body {
margin: 0;
font-family: "Raleway", Helvetica, sans-serif;
color: #313;
@jorpic
jorpic / index.html
Created January 8, 2015 09:46
MathJax + Markdown
<!doctype html>
<html>
<head>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {
inlineMath: [["$","$"]],
skipTags: ['script', 'noscript', 'style']
}
});
@jorpic
jorpic / index.html
Created January 13, 2015 08:01
d3.js brush alignment
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style>
body { text-align: center; }
svg { font: 10px sans-serif; }
path, line {
fill: none;
stroke: #000;