Skip to content

Instantly share code, notes, and snippets.

View hantuzun's full-sized avatar
🥽
Burnt out

Han Tuzun hantuzun

🥽
Burnt out
View GitHub Profile
@hantuzun
hantuzun / MergeSort.java
Created September 26, 2013 09:13
MergeSort in Java
import java.util.Arrays;
public class MergeSort {
public static int[] sort(int[] input) {
int len = input.length;
int mid = (len) / 2;
if (len <=1)
return input;
@hantuzun
hantuzun / run-java.sh
Created October 13, 2013 14:07
Shell file for running .class files on a XTerm window. Used for compiling and running Java source files directly from Sublime Text 3 on Ubuntu 13.10.
#!/bin/bash
# Called by Java.sublime-build
# Located in /usr/bin
# $1 := $file_path
# $2 := $file
# $3 := $file_base_name
# Runs .class files on a XTerm window
@hantuzun
hantuzun / subsetGenerator
Created September 29, 2014 08:13
Creates all subsets of a given int array using gray codes and Integer class methods.
import java.util.Arrays;
public class subsetGenerator{
public static void main(String []args){
int[] input = {0, 1, 2, 3, 4};
int[][] subsets = subsetGenerator(input);
for (int[] subset : subsets) {
System.out.println(Arrays.toString(subset));
}
@hantuzun
hantuzun / osx.sh
Last active August 29, 2015 14:08 — forked from matthewmueller/osx-for-hackers.sh
My OSX Setup for Yosemite
#!/bin/sh
# My OSX Setup for Yosemite
#
# Source: https://gist.github.com/emrehan/53d8a9668ae616b03b55
# Ask for the administrator password upfront
sudo -v
###############################################################################
@hantuzun
hantuzun / rubik.c
Created October 28, 2014 04:23
A rubik's cube simulator. I wrote that during the IEEEXtreme 5.0 in 2011. The question can be found here: http://zaidpirwani.com/wp-content/uploads/downloads/2012/11/ieee-xtreme-6.0-faq-sample-questions.pdf
#include <string.h>
char u[3][3];
char l[3][3];
char f[3][3];
char r[3][3];
char b[3][3];
char d[3][3];
char temp[3];
@hantuzun
hantuzun / near_palindrome_checker.asm
Last active August 29, 2015 14:16
near_palindrome_checker.asm
# $t0 = the first char address of the string
# $t1 = the last char address of the string
# $t2 = left iterator
# $t3 = right iterator
# $t4 = left iterator char
# $t5 = right iterator char
# $t7 = the character address to be omitted
#
# Emrehan Tüzün
@hantuzun
hantuzun / sum_durations.py
Created March 15, 2015 13:12
sum durations
durations = ['16:51', '21:00', '20:52', '13:46', '6:09', '12:01', '13:39', '9:04', '8:28', '11:58', '6:27', '6:15', '7:09', '16:11', '14:16', '13:20', '9:42']
mins = 0
secs = 0
for duration in durations:
mins += int(duration.rsplit(':', 1)[0])
secs += int(duration.rsplit(':', 1)[1])
mins += secs / 60
secs = secs % 60
(require '[sparkling.conf :as conf])
(require '[sparkling.core :as sparkling])
(require '[sparkling.destructuring :as destructuring])
(import '[org.apache.spark.mllib.linalg.distributed RowMatrix])
(import '[org.apache.spark.mllib.linalg Vectors])
(import '[org.apache.spark HashPartitioner])
(def spark-config (-> (conf/spark-conf)
(conf/master "local")
(conf/app-name "item similarities")))
{
"swagger": "2.0",
"info": {
"version": "0.0.5",
"title": "Spock",
"description": "Spock gives sparkling recommendations to Kirk",
"contact": {
"name": "SuggestGrid Inc."
}
},
@hantuzun
hantuzun / links_to_metadata.awk
Last active April 5, 2016 03:31
Creates item metadata json file form links.csv of http://files.grouplens.org/datasets/movielens/ml-latest.zip