Skip to content

Instantly share code, notes, and snippets.

View aycanirican's full-sized avatar
💭
Lifelong learning

Aycan iRiCAN aycanirican

💭
Lifelong learning
View GitHub Profile

Keybase proof

I hereby claim:

  • I am aycanirican on github.
  • I am aycan (https://keybase.io/aycan) on keybase.
  • I have a public key ASCetXizucbRp_ibah6txD_zV0Dse1iLP1x5VYc_VhjQrwo

To claim this, I am signing this object:

// password based key derivation function 1 with SHA256 (PBKDF1SHA256) in golang
// strength 2^17
func PBKDF1SHA256(pass []byte, salt []byte) []byte {
h := sha256.Sum256(append(pass, salt...)) // first_hash
for i := 0; i <= 1<<17; i++ {
h = sha256.Sum256(h[:])
}
return h[:]
}
@aycanirican
aycanirican / Main.hs
Created December 9, 2016 06:18 — forked from abakst/Main.hs
module Main where
import Control.Distributed.Process hiding (call)
import Control.Distributed.Process.Node as Node (initRemoteTable, runProcess)
import Control.Distributed.Process.Extras (resolve, __remoteTable)
import Control.Distributed.Process.Backend.SimpleLocalnet
import Control.Concurrent (threadDelay)
import Control.Monad
import Network.Transport hiding (send)
import System.Environment
### Keybase proof
I hereby claim:
* I am aycanirican on github.
* I am iricanaycan (https://keybase.io/iricanaycan) on keybase.
* I have a public key whose fingerprint is 308E 2721 5E27 3213 975E E92D 2592 7083 2D00 2BBF
To claim this, I am signing this object:
@aycanirican
aycanirican / UDPEchoServer.hs
Created October 21, 2014 05:55
haskell udp example found in the wild
--
-- UDPEchoServer.hs: Exactly what the name says, a datagram echo server.
--
module Main (main) where
import Network.Socket
import System.Posix.Directory
import System.Posix.Files
@aycanirican
aycanirican / gist:2031542
Created March 13, 2012 21:00
19k request/sec on dragonflybsd.
% # source: https://github.com/aycanirican/hlibev/blob/master/Examples/ByteStringConcurrent.hs
% dmesg | grep GHz
CPU: Pentium(R) Dual-Core CPU E6300 @ 2.80GHz (2799.48-MHz K8-class CPU)
% curl http://192.168.1.100:5002/
Hello, World!
% uname -a
DragonFly x 3.1-DEVELOPMENT DragonFly v3.1.0.299.g62f17-DEVELOPMENT #13: Mon Mar 12 12:39:42 EET 2012 root@x:/usr/obj/usr/src/sys/MYKERNEL x86_64
@aycanirican
aycanirican / gist:2023676
Created March 12, 2012 18:03
dragonflybsd haskell libev binding Hello World.
% ab -n 10000 -c 10 http://127.0.0.1:8080/
This is ApacheBench, Version 2.0.41-dev <$Revision: 1.121.2.12 $> apache-2.0
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 2006 The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
@aycanirican
aycanirican / gist:2007001
Created March 9, 2012 15:26
dragonflybsd ssh session close
]112[detached]
%
assertion: (*bmp & (1LU << bno)) == 0 in memfree
Connection to xxxxxxx closed.
@aycanirican
aycanirican / gist:1964940
Created March 3, 2012 08:10
buildworld fails
===> lib/libalias
cc -march=nocona -O2 -pipe -std=gnu99 -Wsystem-headers -Werror -Wall -Wno-uninitialized -c /usr/src/lib/libalias/alias.c -o alias.o
cc1: warnings being treated as errors
/usr/src/lib/libalias/alias.c: In function 'PacketUnaliasOut':
/usr/src/lib/libalias/alias.c:1518: error: dereferencing pointer 'sptr' does break strict-aliasing rules
/usr/src/lib/libalias/alias.c:1517: note: initialized from here
/usr/src/lib/libalias/alias.c:1519: error: dereferencing pointer 'sptr' does break strict-aliasing rules
/usr/src/lib/libalias/alias.c:1518: note: initialized from here
/usr/src/lib/libalias/alias.c:1561: error: dereferencing pointer 'sptr' does break strict-aliasing rules
/usr/src/lib/libalias/alias.c:1560: note: initialized from here
@aycanirican
aycanirican / gist:1948410
Created March 1, 2012 08:49
DragonflyBSD head: getErrno yields SIGSEGV
Prelude> :m +Foreign.C.Error
Prelude Foreign.C.Error> a <- getErrno
Program received signal SIGSEGV, Segmentation fault.
0x0000000803d0bb04 in _umtx_wakeup_err () from /usr/lib/libpthread.so.0
(gdb) info threads
Id Target Id Frame
* 1 process 46132 0x0000000803d0bb04 in _umtx_wakeup_err () from /usr/lib/libpthread.so.0
(gdb) bt
#0 0x0000000803d0bb04 in _umtx_wakeup_err () from /usr/lib/libpthread.so.0