Skip to content

Instantly share code, notes, and snippets.

Avatar

Erik Fonselius Fonsan

View GitHub Profile
View count.rb
require 'json'
require 'time'
counting_hash = Hash.new(0)
line_enumerator = STDIN.each_line
line_enumerator.each do |line|
puts line
end
View tw.sh
# https://streamlink.github.io/
tw() {
TMPFILE=`mktemp`
echo $TMPFILE
vlc $TMPFILE &
streamlink --hls-segment-threads 10 -f -o $TMPFILE $1 best
}
View gist:6889e4cc4fff89a634c0d52f593db07b
2016-12-27 20:49:17 1.5 GiB pbfs/africa-161201.osm.pbf
2016-12-27 20:49:27 28.9 MiB pbfs/antarctica-161201.osm.pbf
2016-12-27 20:49:27 4.5 GiB pbfs/asia-161201.osm.pbf
2016-12-27 20:49:59 493.6 MiB pbfs/australia-oceania-161201.osm.pbf
2016-12-27 20:50:02 248.9 MiB pbfs/central-america-161201.osm.pbf
2016-12-27 20:50:04 18.0 GiB pbfs/europe-161201.osm.pbf
2016-12-27 20:52:05 7.5 GiB pbfs/north-america-161201.osm.pbf
2016-12-27 20:52:57 981.0 MiB pbfs/south-america-161201.osm.pbf
Total Objects: 8
View PureFTPD
sudo yum update # -yes?
sudo yum groupinstall "Development Tools"
sudo yum install openssl-devel htop
mkdir install
cd install
wget http://download.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-1.0.41.tar.gz
tar -xvzf pure-ftpd-1.0.41.tar.gz
cd pure-ftpd-*
./configure --with-tls --with-ftpwho --with-puredb --without-pam
make
View popen3_test.rb
require 'open3'
module Enumerable
alias :all_are? :all?
end
Open3.popen3(%(ruby -e 'STDOUT.sync = true; STDERR.sync = true;3.times { |i| STDOUT.puts(i); STDERR.puts(i); sleep 1 }')) do |stdin, stdout, stderr, wait_thr|
maxlen = 1024
pipes = {
stdout => :stdout,
View coord_collector.py
import zlib
from imposm.parser.pbf.parser import PBFFile, PrimitiveBlockParser
import imposm.parser.pbf.parser
import imposm.parser.pbf
import StringIO
import cachetools
import bisect
import sys
import resource
import random
View pbfs.rb
require 'open-uri'
require 'nokogiri'
date = (Date.today - 2).strftime("%y%m%d")
paths = %w(
africa
asia
australia-oceania
central-america
europe
View gist:69a2b14f079b4885ef2a
parallel_fetch(ServerPid, FirstKey, SecondKey, ThirdKey) ->
FirstRequestId = make_ref(),
SecondRequestId = make_ref(),
ThirdRequestId = make_ref(),
ServerPid ! {self(), FirstRequestId, FirstKey},
ServerPid ! {self(), SecondRequestId, SecondKey},
ServerPid ! {self(), ThirdRequestId, Thirdkey},
FirstValue = receive
View keybase.md

Keybase proof

I hereby claim:

  • I am Fonsan on github.
  • I am Fonsan (https://keybase.io/Fonsan) on keybase.
  • I have a public key whose fingerprint is CA01 210C 0B82 03F4 D398 E46A B39E DC79 D3A5 A0CF

To claim this, I am signing this object:

View index.erb
<html>
<head>
<meta http-equiv="refresh" content="3" >
<title>LOL</title>
</head>
<body>
<img style="width:100%;height:100%" src="data:image/gif;base64,<%= @image %>">
</body>
</html>