Skip to content

Instantly share code, notes, and snippets.

View Lupus's full-sized avatar

Konstantin A. Olkhovskiy Lupus

View GitHub Profile
package forma;
import forma.WholeFileInputFormat;
import cascading.scheme.Scheme;
import cascading.tap.Tap;
import cascading.tuple.Fields;
import cascading.tuple.Tuple;
import cascading.tuple.TupleEntry;
import java.io.IOException;
import org.apache.hadoop.mapred.JobConf;
//===========================================================================
// Copyright 2005,2006 Don Hatch
// Permission is hereby granted to everyone to use this source code
// or any part of it for any purpose as long as it is good and not evil.
//
// Author: Don Hatch (hatch@plunk.org)
// Last Modified: Tue Feb 21 18:50:39 PST 2006
//===========================================================================
//
// backtracefilt.C - program for filtering the output of backtrace() on Linux,
@Lupus
Lupus / latency.txt
Last active August 29, 2015 14:09 — forked from jboner/latency.txt
Latency Comparison Numbers
--------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns
Send 1K bytes over 1 Gbps network 10,000 ns 0.01 ms
Read 4K randomly from SSD* 150,000 ns 0.15 ms
@Lupus
Lupus / mhash.h
Last active August 29, 2015 14:17 — forked from funny-falcon/mhash.h
/*
* Copyright (C) 2011, 2012, 2013, 2014 Mail.RU
* Copyright (C) 2011, 2012, 2013, 2014 Yuriy Vostrikov
* Copyright (C) 2014 Yuriy Sokolov aka funny_falcon
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
package main
import (
"bytes"
"html/template"
"log"
"time"
)
func b1() {
@Lupus
Lupus / translate.go
Created October 24, 2015 20:39 — forked from hvoecking/translate.go
Golang reflection: traversing arbitrary structures
// Traverses an arbitrary struct and translates all stings it encounters
//
// I haven't seen an example for reflection traversing an arbitrary struct, so
// I want to share this with you. If you encounter any bugs or want to see
// another example please comment.
//
// The MIT License (MIT)
//
// Copyright (c) 2014 Heye Vöcking
//
@Lupus
Lupus / reflection.go
Created October 28, 2015 12:54 — forked from drewolson/reflection.go
Golang Reflection Example
package main
import (
"fmt"
"reflect"
)
type Foo struct {
FirstName string `tag_name:"tag 1"`
LastName string `tag_name:"tag 2"`
@Lupus
Lupus / ipcalc.go
Created July 19, 2016 12:21 — forked from kotakanbe/ipcalc.go
get all IP address from CIDR in golang
package main
import (
"net"
"os/exec"
"github.com/k0kubun/pp"
)
func Hosts(cidr string) ([]string, error) {
@Lupus
Lupus / terra_return_by_value_issue.t
Created November 24, 2016 16:19
Terra return by value reproducible test case
local S = require("std")
-- some helper declarations
local size_t = uint64
local LUA_TSTRING = 4
local struct lua_State
@Lupus
Lupus / terra_lua_c_api_issue.t
Created November 28, 2016 10:25
Second repro with shared library, problem appears only in jit mode
local S = require("std")
-- some helper declarations
local size_t = uint64
local LUA_TSTRING = 4
local struct lua_State