Skip to content

Instantly share code, notes, and snippets.

@korczis
korczis / preseed.pkg
Created May 20, 2014 01:51
apollo-fat-box packer.io ubuntu installer preseed config
# This is preseed
@korczis
korczis / apollo-couch-node.js
Created May 23, 2014 22:17
Microcrawler CouchDB storage backend
var dbName = 'apollo-web-gui';
var nano = require('nano')('http://localhost:5985');
nano.db.create(dbName);
var db = nano.db.use(dbName);
// Register on data event handler
engine.on('data', function (result) {
logger.info('DATA: ' + JSON.stringify(result, null, 4));
db.insert(result, null, function(err, body, header) {
# encoding: utf-8
require 'multi_json'
require 'typhoeus'
require_relative '../connection'
module GoodData
module Rest
module Connections
awk -F, 'NR > 1 { print "\"http://"$2"\"," }' < top-1m.csv > top-1m-fixed.csv
# See http://public.hronopik.de/vid.stab/
# See http://ffmpeg.org/ffmpeg-filters.html#vidstabtransform-1
# Concat
ls Movie_Part_1.mp4 Movie_Part_2.mp4 | perl -ne 'print "file $_"' | ffmpeg -f concat -i - -c copy MVI_JOINED_ENCODED.mp4
# First pass
ffmpeg -i MVI_JOINED_ENCODED.mp4 -vf vidstabdetect=shakiness=10:accuracy=15:result=MVI_JOINED_ENCODED.trf -strict -2 MVI_JOINED_ENCODED_TRANSFORM.mp4
# Second pass
{
"intro": {
"background": {
"text": "Following more than three centuries under Portuguese rule, Brazil gained its independence in 1822, maintaining a monarchical system of government until the abolition of slavery in 1888 and the subsequent proclamation of a republic by the military in 1889. Brazilian coffee exporters politically dominated the country until populist leader Getulio VARGAS rose to power in 1930. By far the largest and most populous country in South America, Brazil underwent more than a half century of populist and military government until 1985, when the military regime peacefully ceded power to civilian rulers. Brazil continues to pursue industrial and agricultural growth and development of its interior. Exploiting vast natural resources and a large labor pool, it is today South America's leading economic power and a regional leader, one of the first in the area to begin an economic recovery. Highly unequal income distribution and crime remain pressing problems."
}
},
"geo
@korczis
korczis / build-ghc-arm.sh
Last active August 29, 2015 14:04
The state of GHC on ARM
#!/bin/bash -e
bindir=`pwd`/bin-tmp
mkdir -p $bindir
export PATH=$bindir:$PATH
function use_ld() {
rm -f $bindir/ld
ln -s $1 $bindir/ld
echo "Using $1 for ld"
}
@korczis
korczis / skull-haskell.hs
Last active August 29, 2015 14:04
My attempt to learn haskell
module Main where
addVectors :: (Num a) => (a, a) -> (a, a) -> (a, a)
addVectors a b = (fst a + fst b, snd a + snd b)
bmiCalc :: (RealFloat a) => a -> a -> a
bmiCalc weight height = weight / height ^ 2
bmiTell1 :: (RealFloat a) => a -> a -> String
bmiTell1 weight height
-- Based on calculation from http://cs.wikipedia.org/wiki/Vrh_vodorovn%C3%BD
-- TODO: improve http://www.brunel.ac.uk/~spstnpl/BiomechanicsAthletics/StandingLongJump.htm
let delkaSkoku vyska rychlost = rychlost * (sqrt ((2 * vyska) / 9.81))
-- Based on expectations - http://en.wikipedia.org/wiki/Footspeed
-- The fastest human footspeed on record is 44.72 km/h (12.42m/s, 27.79 mph), seen during a 100 meters sprint (average speed between the 60th and the 80th meter) by Usain Bolt. Maximum human sprint speed is strikingly slower than that of many animals.
*Main> delkaSkoku 15 6
10.492461251740034
*Main>
#!/usr/bin/env runhaskell
-- Haskell traceroute over icmp
import Control.Monad
import Data.Bits(complement)
import Data.Char (chr,ord)
import Data.List
import Data.Monoid
import Data.Time