Skip to content

Instantly share code, notes, and snippets.

View huseyinyilmaz's full-sized avatar

Huseyin Yilmaz huseyinyilmaz

  • Balikesir, Turkey
View GitHub Profile
@huseyinyilmaz
huseyinyilmaz / private.xml
Created June 23, 2016 21:54
Karabiner configuration that changes arrow keys to control
<?xml version="1.0"?>
<root>
<item>
<name>Cursor to command</name>
<item>
<name>Arrow to Control_L</name>
<identifier>remap.arrows2controlR</identifier>
<autogen>__KeyToKey__ KeyCode::CURSOR_RIGHT, KeyCode::CONTROL_R</autogen>
<autogen>__KeyToKey__ KeyCode::CURSOR_LEFT, KeyCode::CONTROL_R</autogen>
@huseyinyilmaz
huseyinyilmaz / Makefile
Last active June 20, 2016 17:09
inversionCount.hs
compile:
rm -f Inversions
stack ghc -- -O2 --make -prof -caf-all -auto-all Inversions.hs
only_compile:
rm -f Inversions
stack ghc -- -O2 --make -auto-all Inversions.hs
run_tests: only_compile
./Inversions
@huseyinyilmaz
huseyinyilmaz / median_of_two_sorted_arrays.py
Created April 27, 2016 20:38
Find the median of two sorted arrays
# https://leetcode.com/problems/median-of-two-sorted-arrays/
from bisect import bisect_left
from itertools import takewhile
class Solution(object):
def count_prefix(self, start_idx, st, char):
""" Starting from the start index, checks how many times given character
repeated"""
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def deleteNode(self, node):
"""
:type node: ListNode
@huseyinyilmaz
huseyinyilmaz / map_sample.ipynb
Last active March 11, 2016 21:40
Map and Option type manipulation in scala
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@huseyinyilmaz
huseyinyilmaz / .thrift
Created February 2, 2016 22:35
Thrift sample
service Calculator {
/**
* A method definition looks like C code. It has a return type, arguments,
* and optionally a list of exceptions that it may throw. Note that argument
* lists and exception lists are specified using the exact same syntax as
* field lists in struct or exception definitions.
*/
void ping(),
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def insert(self, head, node):
if head is None:
node.next = None
--https://leetcode.com/problems/merge-intervals/
module Main where
import Test.HUnit
import Data.List(sort)
data Interval = Interval Int Int deriving (Show, Eq, Ord)
merge :: [Interval] -> [Interval]
merge intervals = merge' $ sort intervals
where