Skip to content

Instantly share code, notes, and snippets.

Gokberk Yaltirakli gkbrk

Block or report user

Report or block gkbrk

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@gkbrk
gkbrk / dict_server.rs
Created Aug 25, 2015
Dictionary server in Rust.
View dict_server.rs
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
gkbrk / list.json
Created Feb 23, 2015
DontBeLazy Block List
View list.json
[
"http://9gag.com",
"https://www.facebook.com",
"http://www.facebook.com",
"https://www.reddit.com",
"http://www.reddit.com"
]
View AsteroidsGame.cpp
#include <vector>
#include <iostream>
#include <SDL2/SDL.h>
#include "GameState.h"
class AsteroidsGame: public GameState{
public:
void Draw(){
@gkbrk
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
gkbrk / series.pl
Created Apr 11, 2016
Serie tracker
View series.pl
#!/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
gkbrk / referrerparse.go
Created Aug 17, 2016
Referer log parser
View referrerparse.go
package main
import(
"bufio"
"fmt"
"os"
"log"
"strings"
"net/url"
)
View Cargo.toml
[package]
name = "urlshortener"
version = "0.1.0"
authors = ["Gökberk Yaltıraklı <webdosusb@gmail.com>"]
[dependencies]
nickel = "*"
hyper = "*"
rand = "0.3.11"
@gkbrk
gkbrk / todograph.py
Last active Apr 18, 2017
Todo.txt to graph
View todograph.py
#!/usr/bin/python3
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
gkbrk / client.py
Created Aug 10, 2015
Python client test
View client.py
import curses
import sys
import random
import hackchat
import threading
class HackClient:
def __init__(self, nick, channel):
self.nick = nick
self.channel = channel
@gkbrk
gkbrk / rust_md5.md
Created Dec 10, 2015
Rust MD5 [AdventOfCode]
View rust_md5.md

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)
You can’t perform that action at this time.