Skip to content

Instantly share code, notes, and snippets.

@ayberk
ayberk / casefixer.py
Last active December 14, 2015 03:29
I was irritated by a full caps subtitle file. Here is the script that fixed it. Nothing fancy, it simply capitalizes every single line. The results are surprisingly acceptable, tho.
import sys
import os
if len(sys.argv) != 2:
print "usage: ./", sys.argv[0], "<file name>"
sys.exit()
OUTNAME = sys.argv[1]
@ayberk
ayberk / download.py
Last active December 24, 2015 06:19
download all files with given extensions
import requests
import os.path
import sys
from bs4 import BeautifulSoup
if len(sys.argv) is not 2:
print "Usage: %s <url>\n" % sys.argv[0]
URL = sys.argv[1]
EXTENSIONS = ['pdf']
@ayberk
ayberk / gist:6755947
Created September 29, 2013 19:57
eksi sozluk'te en begenilen entryleri okumayi kolaylastiran hede
// ==UserScript==
// @name Eksi Begenilenler
// @namespace 127.0.0.1
// @version 0.1
// @description En begenilenleri ayni sayfada gor
// @match https://eksisozluk.com/istatistik/dunun-en-begenilen-entryleri
// @match https://eksisozluk.com/istatistik/gecen-haftanin-en-begenilen-entryleri
// @match https://eksisozluk.com/istatistik/tsllbnnin-formulu
// @require http://code.jquery.com/jquery-latest.js
// ==/UserScript==
@ayberk
ayberk / command.js
Last active December 27, 2015 11:49 — forked from JoelBesada/README.md
var url = document.URL;
javascript:(function(){
//window.twttr=window.twttr||{};
var D=550,A=450,C=screen.height,B=screen.width,H=Math.round((B/2)-(D/2)),G=0,F=document,E;
if(C>A){
G=Math.round((C/2)-(A/2))
}
var win =window.open('http://twitter.com/share','','left='+H+',top='+G+',width='+D+',height='+A+',personalbar=0,toolbar=0,scrollbars=1,resizable=1');
//var win = window.twtter.shareWin;
win.focus();
private static void threeWayQuickSort(int[] a, int lo, int hi)
{
if (hi <= lo) return;
int i = lo;
int lessThan = lo;
int greaterThan = hi;
int pivot = a[lo];
while (i <= greaterThan)
/**
* Created by ayberk on 4/29/14.
*
* A string s is a cyclic rotation of a string t if s and t have the same length and
* s consists of a suffix of t followed by a prefix of t.
* For example, "winterbreak" is a cyclic rotation of "breakwinter" (and vice versa).
* Design a linear-time algorithm to determine whether one string is a cyclic rotation of another.
*/
public class CyclicStrings
{
package crackingthecodinginterview;
/**
* Created by ayberk on 4/30/14.
*
* 43 Given a sorted (increasing order) array, write an algorithm to create a binary tree with minimal height
*/
import datastructures.*;

Keybase proof

I hereby claim:

  • I am ayberk on github.
  • I am ayberk (https://keybase.io/ayberk) on keybase.
  • I have a public key whose fingerprint is BE86 8817 A371 C047 7D34 305C 2BB0 D486 1ACF BDAE

To claim this, I am signing this object:

import java.util.ArrayList;
/**
* Created by ayberk on 2/3/15.
*/
public class sdfsf
{
private static ArrayList<String> combs = new ArrayList<String>();
public static void setCombs(String initial) {
import java.util.Set;
import java.util.HashMap;
import java.util.HashSet;
import java.util.TreeSet;
import java.util.ArrayList;
public class Problem7_5 {
static HashMap<Character, String> map;
private static void prepareDictionary() {