Skip to content

Instantly share code, notes, and snippets.

View sebnow's full-sized avatar

Sebastian Nowicki sebnow

View GitHub Profile

Keybase proof

I hereby claim:

  • I am sebnow on github.
  • I am sebnow (https://keybase.io/sebnow) on keybase.
  • I have a public key ASDSxQF2Gjhp_13pKiI7d75LFeL-jz0GL-pPjhQxwBizYwo

To claim this, I am signing this object:

@sebnow
sebnow / dispatch.pl
Created January 12, 2012 12:29
ZeroMQ Worker Job Dispatch (Perl)
#!/usr/bin/perl
=head1 NAME
dispatch.pl - Dispatch work to workers
=head1 SYNOPSIS
cat /proc/vmstat | perl dispatch.pl
@sebnow
sebnow / geocode.pl
Created October 22, 2011 07:30
Geocoding in Perl using Google Maps API v3
#!/usr/bin/env perl
use strict;
use warnings;
use Geo::Coder::Google;
my $geocoder = Geo::Coder::Google->new(apiver => 3);
print(join(', ', qw(Address Lattitude Longitude)) . "\n");
while(my $address = <>) {
my $location = $geocoder->geocode(location => $address);
print(join(', ',
@sebnow
sebnow / zeromq.hs
Created July 23, 2011 03:31
Haskell ZeroMQ - Hello World!
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Control.Monad (forever)
import Control.Concurrent (forkIO)
import qualified Data.ByteString.Char8 as B
import System.ZMQ
connect' :: String -> (Socket Req -> IO ()) -> Context -> IO ()
connect' endpoint f ctx = withSocket ctx Req (\s -> connect s endpoint >> f s)
@sebnow
sebnow / onet.go
Created September 10, 2010 05:13
Onet Czat API
package onet
import (
"xml"
"io"
"fmt"
"http"
"os"
"net"
"bufio"
@sebnow
sebnow / ocauth.c
Created September 10, 2010 05:11
Onet Czat AUTH Key decryption
/* Copyright (c) 2010 Sebastian Nowicki <sebnow@gmail.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
@sebnow
sebnow / perl_threads.pl
Created September 4, 2010 08:59
Example of Perl 5.6 threads
#!/usr/bin/env perl
# This script simply shows how to use Perl 5.6 threads. It doesn't actually do anything.
use v5.6;
use strict;
use warnings;
use threads;
use threads::shared;
@sebnow
sebnow / pre-commit.gofmt
Created April 9, 2010 12:00
Git pre-commit hook which checks if gofmt fails on any *.go files
#!/bin/bash
root=$(git rev-parse --show-cdup)
[ "x$root" = "x" ] && root=.
IFS=$'\n'
status=0
files=''
# Get a list of staged refs
for object in $(git ls-files -s --full-name $root | sed -e 's/^.* \([a-zA-Z0-9][a-zA-Z0-9]*\)[\t ]*[0-9][0-9]*.\(.*\)$/\1 \2/'); do
ref=$(echo $object | cut -d' ' -f1)
name: foo
version: 1.0
release: 1
summary: A fictional package to show the YAML package format
description: >
This package is an example of the YAML universal package format, which
aims to be portable and extandable. This description can be as long as
it needs to be.
architectures: # Values denote architectures supported by this package
any: