Skip to content

Instantly share code, notes, and snippets.

View Bencoding.hs
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RankNTypes #-}
module Bencoding where
import Control.Applicative
import Crypto.Hash.SHA1
import Data.Attoparsec.ByteString.Char8 (Parser)
import qualified Data.Attoparsec.ByteString.Char8 as P
import Data.ByteString as B
import Data.ByteString.Char8 as BC
View gist:32364f5ad91618937ce6
clients = []
message_queue = []
# entrypoint websocketa
def incoming_request(connection)
end do
while x = message_queue.shift
View gist:03f79bbe5b68e7f67ea5
### Keybase proof
I hereby claim:
* I am farnoy on github.
* I am farnoy ( on keybase.
* I have a public key whose fingerprint is 101C C2F9 9202 4836 6255 BCBB 7660 5A32 464C 5A46
To claim this, I am signing this object:
View gist:8872600
[51:52.41] Ogre Magi receives Cold Snap debuff from Invoker.
[51:52.41] Ogre Magi loses Teleporting buff.
[51:52.44] Anti-Mage (Illusion) hits Ogre Magi for 39 damage (470->431).
[51:52.51] Anti-Mage (Illusion) hits Ogre Magi for 28 damage (430->402).
[51:52.61] Death Ward hits Ogre Magi for 53 damage (402->349).
[51:52.74] Anti-Mage hits Ogre Magi with Mana Void for 1176 damage.
[51:52.74] Ogre Magi is killed by Anti-Mage!
View gist:7371366
use std::hashmap::HashMap;
trait Test {}
impl Test for uint {}
fn main() {
let a: &uint = &15;
let thing: &Test = a as &Test;
let mut map: HashMap<uint, &Test> = HashMap::new();
View gist:7308670
@namespace url(;
@-moz-document domain("") {
/* General code display */
pre, code, pre > code,
/* commit refs */
/* commit meta */
farnoy / moderator.rb
Last active Dec 25, 2015
Draft rails adapter for access granted
View moderator.rb
class Roles::Moderator
applies_for -> user { user.moderator? }
definitions do
can :edit, Comment
can :destroy, Thread, locked: false
can :unlock, Thread, If(:locked_by_him)
def locked_by_him
farnoy / gcc -march=generic -Q --help=target
Created Aug 29, 2013
gcc optimizations for my cpu arch
View gcc -march=generic -Q --help=target
The following options are target specific:
-m128bit-long-double [disabled]
-m32 [disabled]
-m3dnow [disabled]
-m3dnowa [disabled]
-m64 [enabled]
-m80387 [enabled]
-m8bit-idiv [disabled]
-m96bit-long-double [enabled]
-mabi= sysv
View gist:6032872
bool exiter::is_handling(const sf::Event::EventType& ev_type) const {
if (ev_type == sf::Event::Closed)
return true;
if (ev_type == sf::Event::KeyPressed)
return true;
return controller::is_handling(ev_type);
bool exiter::handle(const sf::Event& event, runner& runner) {
farnoy / gist:6024657
Created Jul 17, 2013
c++ Constexprs in std::chrono
View gist:6024657
kuba@kuba-desk ~ $ cat
#include <chrono>
int test() {
std::chrono::hours h{1};
std::chrono::minutes m = ++h;
return m.count();