Skip to content

Instantly share code, notes, and snippets.

View tufanbarisyildirim's full-sized avatar
🎯
Focusing

Tufan Barış Yıldırım tufanbarisyildirim

🎯
Focusing
View GitHub Profile
@tufanbarisyildirim
tufanbarisyildirim / SqlClassGenerator.tt
Created November 20, 2013 14:02
Basic Model Class Generator
<#@ assembly name ="System.Data" #>
<#@ assembly name ="System.Xml" #>
<#@ import namespace="System.Collections.Generic" #>
<#@ import namespace="System.Data.SqlClient" #>
<#@ import namespace="System.Data" #>
<#@ import namespace="System.Text" #>
<#+
class SQLClassGenerator
{
Dictionary<Type, string> _alias = new Dictionary<Type, string>();
# Add multimedia source
echo "deb http://www.deb-multimedia.org wheezy main non-free" >> /etc/apt/sources.list
echo "deb-src http://www.deb-multimedia.org wheezy main non-free" >> /etc/apt/sources.list
apt-get update
apt-get install deb-multimedia-keyring # if this aborts, try again
apt-get update
# Go to local source directory
cd /usr/local/src
Verifying that +tfnyldrm is my blockchain ID. https://onename.com/tfnyldrm
@tufanbarisyildirim
tufanbarisyildirim / hash.go
Last active April 29, 2020 13:37
zero allication fnv hashing of #golang
// https://github.com/golang/go/blob/master/src/hash/fnv/fnv.go#L100 the code we previously used
// has some allocations
// we need minimum footprint per deciding
func findIndex(s string, poolSize uint32) uint32 {
var h32a uint32 = 2166136261
for _, c := range []byte(s) {
h32a *= 16777619
h32a ^= uint32(c)
}

Before Inlining

BenchmarkNextHash-16                    12962270                83.4 ns/op            20 B/op          2 allocs/op

After Inlining

BenchmarkNextHash-16                    32723619                33.9 ns/op             0 B/op          0 allocs/op