Skip to content

Instantly share code, notes, and snippets.


Emre Aladağ aladagemre

View GitHub Profile
aladagemre /
Created Dec 30, 2020
N11 kategori listesini çeken bir script
import bs4
import csv
import requests
r = requests.get("")
soup = bs4.BeautifulSoup(r.text, features="html.parser")
with open("kategoriler.csv", "w") as csvfile:
writer = csv.writer(csvfile, delimiter=';', quotechar='"')
mcs = [(a.text, a.get('href')) for a in soup.find_all("a", class_="main-category")]
aladagemre /
Created Jul 12, 2020
Madrid Polen Crawler
This is a script for parsing polen levels in Madrid, Spain.
It used to work in 2019 but you may need to make fixes to make it work in the following years.
import re
import locale
import time
import logging
import requests
View tweetfetcher.go
package controllers
import (
aladagemre /
Created Dec 6, 2016
Check whether a pandas dataframe contains rows with a value that exists in another dataframe.
# We have dataframe A with column name
# We have dataframe B with column name
# I want to see rows in A with name Y such that there exists rows in B with name Y.
# It's like set intersection.
intersected = reduce(lambda x, y: x | (A['name'] == y), [False] + list(B['name']))
intersection = A[intersected]
# other alternatives
intersection = pd.merge(A, B, how='inner', on=['name'])
aladagemre /
Created May 2, 2016
Çok basit ve özensizce hazırlanmış bir bordro hesaplama scripti. Aylık brüt maaşı girin, aylık net maaş ve işveren maliyetini çıkarsın.
#encoding: utf-8
import math
ay = 1
BM = {}
EK = {}
AGI = {}
SM = {}
aladagemre /
Created Jan 20, 2016
This script looks for changes in Dropbox folder. Upon any change, waits for the status to be Up to date. When it's fully synced, starts a build process (/app/build.bin).
uptodate () {
# returns 1 if up to date, 0 otherwise.
python /root/ status | grep "Up to date" |wc -l
build_after_uptodate() {
while [ "$(uptodate)" != "1" ]; do
sleep 1
aladagemre /
Created Dec 9, 2015
igraph c binding code
lib IGraph
VS_ALL = 0
VS_ADJ = 1
VS_1 = 3
aladagemre /
Created Aug 24, 2015
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 /
Created Jun 24, 2015
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 /
Created Feb 10, 2015
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 = []