Skip to content

Instantly share code, notes, and snippets.

View aladagemre's full-sized avatar

Emre Aladağ aladagemre

View GitHub Profile
@aladagemre
aladagemre / mp4_total_duration.py
Created August 24, 2015 17:53
Recursive mp4 duration counter
"""
When you have lots of mp4 files in a folder recursively (lots of subfolders and mp4s residing inside),
You can use this script to measure total duration of all mp4 files.
Useful in estimating the total course duration.
Run this script in folder where you want to start counting from.
"""
import subprocess
@aladagemre
aladagemre / tdk-esanlam.py
Created June 24, 2015 17:42
TDK'dan bir küme kelimenin eş anlamlılarını çeken betik
# coding: utf-8
# TDK sözlüğünden eş anlamlıları çeker.
# words.txt dosyasında her satırda bir kelime olacak şekilde girdi listelenir.
# meanings.txt dosyasına her kelime için eş anlamlılarını bulur ve satır satır yazar.
import requests
import codecs
from bs4 import BeautifulSoup
@aladagemre
aladagemre / jekyll2pelican.py
Created February 10, 2015 16:25
Jekyll to Pelican convertor. Only fixes categories, tags list to comma separated tags and single category
# encoding: utf-8
import os
filenames = filter(lambda x: x.endswith(".md"), os.listdir("."))
def parse(filename):
print filename
lines = open(filename).read().split("\n")
tags_i = None
last_tag_i = None
tags = []
@aladagemre
aladagemre / sehirler.html
Created November 10, 2014 17:50
Türkiye Şehir Listesi HTML Select Option
<select name="Sehir">
<option value="0">------</option>
<option value="1">Adana</option>
<option value="2">Adıyaman</option>
<option value="3">Afyonkarahisar</option>
<option value="4">Ağrı</option>
<option value="5">Amasya</option>
<option value="6">Ankara</option>
<option value="7">Antalya</option>
<option value="8">Artvin</option>
@aladagemre
aladagemre / raspberry_temperature.py
Last active August 29, 2015 14:02
Raspberrypy Temperature Logger
import time
import datetime
period = 1 # secs between each measurement
filename = "output.csv" # filename to write data.
def get_temperature():
# Open the file that we viewed earlier so that python can see what is in it. Replace the serial number as before.
tfile = open("/sys/bus/w1/devices/10-000802824e58/w1_slave")
# Read all of the text in the file.
@aladagemre
aladagemre / quickcheckout.php
Created May 21, 2014 11:20
Dreamvention Ajax Quick Checkout Turkish translation
<?php
$_['option_register_payment_address_title'] = 'Ödeme detayları';
$_['option_register_payment_address_description'] = '';
$_['option_register_shipping_address_title'] = 'Teslimat detayları';
$_['option_register_shipping_address_description'] = '';
$_['option_register_shipping_method_title'] = 'Teslimat yöntemi';
$_['option_register_payment_method_title'] = 'Ödeme yöntemi';
$_['option_guest_payment_address_title'] = 'Ödeme detayları';
@aladagemre
aladagemre / d_social_login.php
Created May 21, 2014 11:14
Dreamvention Social Login Turkish translation
<?php
// Heading
$_['heading_title'] = 'Hesap';
// Text
$_['text_sign_in_with_google'] = 'Giriş Yap';
$_['text_sign_in_with_facebook'] = 'Giriş Yap';
$_['text_sign_in_with_twitter'] = 'Giriş Yap';
$_['text_sign_in_with_live'] = 'Giriş Yap';
$_['text_sign_in_with_linkedin'] = 'Giriş Yap';
@aladagemre
aladagemre / skulpt-reveal.html
Created February 20, 2014 21:51
Skulpt embedded in reveal.js: place Python interpreter in your reveal.js slides!
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>reveal.js - The HTML Presentation Framework</title>
<meta name="description" content="A framework for easily creating beautiful presentations using HTML">
<meta name="author" content="Hakim El Hattab">
@aladagemre
aladagemre / heroku-bootup.py
Created November 12, 2013 18:21
Django project generation with Heroku and django-skel
import os
REGION = raw_input("Region? [US/eu] ").strip().lower() != "eu"
if REGION:
REGION = "us"
else:
REGION = "eu"
PROJECT_NAME = raw_input("Project name: ")
APP_NAME = raw_input("Initial app name: ")
USE_PGSQL = raw_input("Use PostgreSQL app? [Y/n] ").strip().lower() != "n"
@aladagemre
aladagemre / HBaseEdgeInputFormat.java
Created August 27, 2013 13:48
Draft: HBaseEdgeInputFormat for Giraph
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0