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 / cointellect.sh
Created December 22, 2014 12:08
cointellect installer
sudo aptitude install git -y
git clone https://github.com/pooler/cpuminer
cd cpuminer
sudo aptitude install automake -y
sudo aptitude install pkg-config -y
sudo aptitude install gcc -y
sudo aptitude install make -y
sudo aptitude install libcurl3-gnutls-dev -y
./autogen.sh
./configure CFLAGS="-O3"
@emre
emre / quotes.md
Last active August 29, 2015 14:28
code simplicity quotes

“The most famous error in this area is what we call “premature optimization.” That is, some developers seem to like to make things go fast, but they spend time optimizing their code before they know that it’s slow! This is like a charity sending food to rich people and saying, “We just wanted to help people!”

“You generally should not add comments that say what a piece of code is doing. That should be obvious from reading the code. If it isn’t obvious, the code should be made simpler. Only if you can’t make code simpler should you have a comment explaining what it does.

@emre
emre / thumbnail.py
Created March 9, 2010 10:22
thumbnailer class for python
from PIL import Image
class ThumbNail(object):
"""
init function for base Class
Parameters
------------
targetFile:
@emre
emre / django stats
Created March 12, 2010 17:29
code stats for a simple django project
# mirat'in kodu
# <proje>/scripts/stats.py
import glob
import os
SCAN_FOLDER = "../"
stats = {
"python" : 0,
@emre
emre / sort
Created April 27, 2010 15:08
usort()'un guzel bir ozelligi
<?php
$a[] = array(
"name" => "emre",
"price" => 99,
);
$a[] = array(
"name" => "ali",
"price" => 15,
@emre
emre / django svn installer script
Created June 26, 2010 11:17
Django icin SVN installer scripti
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
from distutils.sysconfig import get_python_lib
class Installer(object):
def __init__(self):
self.__controlUser()
@emre
emre / thumbnail_tools
Created July 10, 2010 15:40
python thumbnailler icin isimlendirme isleri
class ThumbnailTools(object):
@staticmethod
def get_thumb_info(file):
reply = re.search("(.*?)\.([a-zA-Z]{3,4})$", file)
return (reply.group(1), reply.group(2))
@staticmethod
def get_thumb_name(file, thumb_type):
file_info = ThumbnailTools.get_thumb_info(file)
@emre
emre / facebook_api_session_validator.py
Created July 26, 2010 09:33
facebook'tan GET olarak donen JSON bilgisinin dogrulugunu kontrol eder.
# -*- coding: utf8 -*-
import hashlib
class FacebookApiSessionValidatorException(Exception):
pass
class FacebookApiSessionValidator(object):
def __init__(self, application_secret, session):
@emre
emre / solr_document_remover.py
Created July 29, 2010 09:52
solr'dan tum kayitlari siler.
import solr
# create a connection to a solr server
s = solr.SolrConnection('http://foo/bar/:8180/solr')
# get all documents
response = s.query('*:*')
for hit in response.results:
s.delete(hit['id'])
s.commit()
@emre
emre / google maps adres arama
Created July 31, 2010 09:57
google maps'te arama icin ufak bir python wrapper
# -*- coding: utf8 -*-
import urllib, simplejson
class GoogleMapsWrapper(object):
def __init__(self, apiKey):
self.api_key = apiKey
def search(self, address):
"""