Skip to content

Instantly share code, notes, and snippets.

View emres's full-sized avatar
💭
"The purpose of computing is insight, not numbers." -- Richard W. Hamming

Emre Sevinç emres

💭
"The purpose of computing is insight, not numbers." -- Richard W. Hamming
View GitHub Profile
@emres
emres / renamer.py
Created December 22, 2009 15:16
A very small and yet-to-be-completed Python program for some sound file renaming.
import os
import glob
import re
file_prefix = "prompt_pronunciation_vl_"
file_extension = ".wav"
index_range = [1, 1139]
index = 1
number_of_zeroes = 4
import matplotlib.pyplot as plt
word_frequencies = []
for line in open("top100.txt"): word_frequencies.append(int(line))
word_freq_ideal = []
d = 1
for x in word_frequencies:
word_freq_ideal.append(word_frequencies[0] / d)
d = d + 1
from turkish.deasciifier import Deasciifier
my_ascii_turkish_txt = "Opusmegi cagristiran catirtilar."
deasciifier = Deasciifier(my_ascii_turkish_txt.decode("utf-8"))
my_deasciified_turkish_txt = deasciifier.convert_to_turkish()
print my_deasciified_turkish_txt.encode("utf-8")
failregex = [[]client <HOST>[]] (Digest: )?user .* (authentication failure|not found|password mismatch)
@emres
emres / subset.py
Created October 23, 2010 10:05
subset.py for the last level in challenge.greplin.com
import itertools
my_set = [3, 4, 9, 14, 15, 19, 28, 37, 47, 50, 54, 56, 59, 61, 70, 73, 78, 81,
92, 95, 97, 99]
def greplin_condition(S):
max_item = max(S)
S.remove(max_item)
if sum(S) == max_item:
return True
@emres
emres / pangram.py
Created November 22, 2010 14:17
Python function to check if a given string is a pangram
from string import ascii_lowercase as al
def is_pangram(s):
return set(al) - set(s.lower()) == set([])
@emres
emres / subtitles.el
Created February 21, 2011 14:23
subtitles.el - work on .srt (subripper) subtitle files
;; -*- mode: emacs-lisp; coding: hebrew-iso-8bit-unix -*-
;; subtitles.el - work on .srt (subripper) subtitle files
;; Copyright (C) 2009 Ehud karni <ehud@xxxxxxxxxxxxxx>
;; This file is NOT part of GNU Emacs, distribution conditions below.
;;
;; EHUD KARNI ינרק דוהא
;; Ben Gurion st' 14 ןוירוג ןב 'חר
;; Kfar - Sava 44 257 אבס - רפכ
;; ==================================
@emres
emres / RandomPuzzle.java
Created July 31, 2011 11:20
A Java puzzler related to random numbers
import java.util.Random;
public final class RandomPuzzle {
public static void main(String[] args) {
for(int i = 0; i < 256; i++) {
System.out.println(new Random(i).nextInt(8));
}
}
}
@emres
emres / swing-demo.scala
Created August 3, 2011 18:10
Adaptation of the JRuby swing demo code from the JRuby Wikipedia article
/*
*
* Adaptation of the JRuby swing demo code from the Wikipedia article at
* http://en.wikipedia.org/wiki/JRuby#JRuby_calling_Java
*
* */
var frame = new javax.swing.JFrame
frame.getContentPane.add(new javax.swing.JLabel("Hello, World!"))
frame.setDefaultCloseOperation(javax.swing.JFrame.EXIT_ON_CLOSE)
@emres
emres / gist:1493114
Created December 18, 2011 11:44
Bash quirk - part 1
$ time echo "why?"
why?
real 0m0.000s
user 0m0.000s
sys 0m0.000s
$ LC_COLLATE=C time echo "why?"
why?
0.00user 0.00system 0:00.00elapsed 0%CPU (0avgtext+0avgdata 2048maxresident)k