Skip to content

Instantly share code, notes, and snippets.

View emre's full-sized avatar
🎯
Focusing

Emre Yılmaz emre

🎯
Focusing
View GitHub Profile
@emre
emre / multiple_sum.java
Created August 12, 2013 14:17
project euler solutions #1
public class MultipleSum {
public int [] multiples;
public int upper_limit;
public MultipleSum(int[] multiples, int upper_limit) {
this.multiples = multiples;
this.upper_limit = upper_limit;
}
@emre
emre / insertion_sort.py
Created August 5, 2013 08:47
insertion sort
def insertion_sort(unsorted_list):
"""
>>> unsorted_list = [5, 9, 2, 99, 3, 128, 3]
>>> insertion_sort(unsorted_list)
>>> unsorted_list
[2, 3, 3, 5, 9, 99, 128]
"""
@emre
emre / selection_sort.py
Created August 4, 2013 22:12
selection sort
def selection_sort(unsorted_list):
"""
>>> unsorted_list = [2, 1, 9, 8, 89]
>>> selection_sort(unsorted_list)
>>> unsorted_list
[1, 2, 8, 9, 89]
"""
@emre
emre / buble_sort.py
Created August 4, 2013 20:49
bubble sort
def bubble_sort(unsorted_list):
"""
bonus: http://www.youtube.com/watch?v=u_tKnsG0rVs
>>> unsorted_list = [2, 1, 9, 8, 89]
>>> bubble_sort(unsorted_list)
>>> unsorted_list
[1, 2, 8, 9, 89]
@emre
emre / binary_search.py
Created August 2, 2013 09:22
binary search implementation
# -*- coding: utf8 -*-
def binary_search(l, value):
""" (list, object) -> int
>>> binary_search([1, 2, 3, 4, 5], 3)
2
>>> binary_search([1, 2, 3, 4, 5], 5)
4
{"css":"<style> body {background-color:black !important;}","javascript":"alert(1);","html":"<font size=45>FOO<\/font>"}
{"response_html": "<script>alert(1);</script>", "status": "success"}
@emre
emre / asdas
Created July 1, 2013 11:38
asd
[{
'picture': 'https://fbexternal-a.akamaihd.net/safe_image.php?d=AQBf467S3bXPAZHB&w=154&h=154&url=http%3A%2F%2Fmedia.chip.com.tr%2Fimages%2Fthumb%2F128%2F2013062918005785172.jpg',
'from': {
'category': 'Computers/internet website',
'name': 'CHIP Online',
'id': '330449759204'
},
'name': u 'Firefox logosu de\u011fi\u015fti!',
'privacy': {
'value': u ''
@emre
emre / change_engine.py
Last active December 18, 2015 21:48
converts all the table engine definitions to INNODB
from lurker.connection import Connection
connection = Connection().quick_connect("friendly", "friendly", "friendly", "localhost")
tables = connection.get_results("SHOW TABLES")
for table in tables:
print table.get("Tables_in_mondotv")
connection.execute("ALTER TABLE {0} ENGINE=INNODB;".format(table.get("Tables_in_mondotv")))
@emre
emre / .tmux.conf
Last active December 18, 2015 07:39
tmux configuration
set -g prefix C-a
unbind C-b
# C-a a should send ctrl-a to the underlying shell (move to start of line)
bind-key a send-prefix
# C-a C-a
bind-key C-a last-window
# config reload