Skip to content

Instantly share code, notes, and snippets.

gkbrk /
Created Aug 25, 2015
Dictionary server in Rust.
use std::io::prelude::*;
use std::net::{TcpListener, TcpStream};
use std::io::BufReader;
use std::thread;
use std::fs::File;
fn get_definitions(word: String) -> Vec<String>{
let mut dict = File::open("dict.txt").unwrap();
let mut reader = BufReader::new(dict);
let mut matches: Vec<String> = Vec::new();
gkbrk / list.json
Created Feb 23, 2015
DontBeLazy Block List
View list.json
View AsteroidsGame.cpp
#include <vector>
#include <iostream>
#include <SDL2/SDL.h>
#include "GameState.h"
class AsteroidsGame: public GameState{
void Draw(){
gkbrk / terminalplayer.c
Created Feb 28, 2016
Terminal radio player
View terminalplayer.c
#include <ncurses.h>
#include <string.h>
#include <unistd.h>
#include <signal.h>
#include <fcntl.h>
typedef struct station {
char name[256];
char url[256];
} station;
gkbrk /
Created Apr 11, 2016
Serie tracker
#!/usr/bin/env perl
use strict;
use warnings;
use HTTP::Tiny;
sub http_get {
my $http = HTTP::Tiny->new;
return $http->get($_[0])->{content};
gkbrk / referrerparse.go
Created Aug 17, 2016
Referer log parser
View referrerparse.go
package main
View Cargo.toml
name = "urlshortener"
version = "0.1.0"
authors = ["Gökberk Yaltıraklı <>"]
nickel = "*"
hyper = "*"
rand = "0.3.11"
gkbrk /
Last active Apr 18, 2017
Todo.txt to graph
import matplotlib.pyplot as plt
import datetime
def get_stats(filename):
data = {}
with open(filename) as todofile:
for line in todofile:
date = line.split()[1]
if date in data:
gkbrk /
Created Dec 10, 2015
Rust MD5 [AdventOfCode]

Is Rust's MD5 Slow? Heck no!

Today I came across this post on the Rust subreddit. Basically it is comparing two MD5 Miners written in Python and Rust. The miner is written for a code challenge called Advent of Code.

To be honest, speed is one of the things I love about Rust, so seeing Rust being blown away by Python (which I also like and use a lot) made me sad. I decided to make this a bit more fair for Rust so I made a very short piece of Rust code to complete this challenge FAST.

The challenge

The challenge, as written on the Advent of Code page is as follows:

  • You are given a key, for example abcdef.
  • You are looking for a string that is made by taking the MD5 of this key plus a number. This hash has to start with 5 leading zeros. (Like abcdef609043)
gkbrk /
Created Mar 10, 2015
Simple port scanner in Python.
import socket
import sys
import threading
import queue
import time
common_ports = {
"21": "FTP",
"22": "SSH",
"23": "Telnet",
You can’t perform that action at this time.