Skip to content

Instantly share code, notes, and snippets.

Mirat Can Bayrak miratcan

Block or report user

Report or block miratcan

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View blockchain_example.py
from hashlib import sha256
from time import time
HARDNESS = 4
VALID_BLOCK_PREFIX = "0" * HARDNESS
def is_valid_hash(hash_str):
return hash_str.startswith(VALID_BLOCK_PREFIX)
@miratcan
miratcan / annotated_turkish_syllables.py
Last active Nov 6, 2019
Python'da Türkçe Heceleme Yapma
View annotated_turkish_syllables.py
def get_syllables(word):
syllables = []
"""
Aşağıdaki satır gelen kelimenin ünlü harfler 1, ünsüzler 0 olacak
şekilde desenini çıkarır.
Örneğin: arabacı -> 1010101, türkiye -> 010010
"""
@miratcan
miratcan / cleanup_disqus_csv.py
Created Oct 9, 2016
Cleanup script for Disqus URL Mapper output.
View cleanup_disqus_csv.py
import sys
from urllib2 import urlopen, HTTPError
from urllib import urlencode, unquote_plus
from json import loads
from time import sleep
API_SECRET = '__YOUR_DUSQUS_APP_API_SECRET__'
FORUM_ID = '___YOUR_DISQUS_FORUM_ID___'
@miratcan
miratcan / logme
Created Oct 9, 2016
593 byte version of logme tool. Simple tool that logs given parameter to ~/.logme/ folder. I'm using it to log my days.
View logme
#!/usr/bin/env python
import zlib, base64
exec(zlib.decompress(base64.b64decode('eJxdUE1PAyEUvPMrcA0BdD+sBw9NMGmbJl6aeGpi1DTYZVvsLlBg+3HxtwvbbFu9ADPvzcx73N4UrbPFl1SFUDtojn6tFZgzbYQCmtXhXCx4G1i7WLBkJi33cMIVHPOj5ZskVJfaHK1crX1smPQAPj4MnlL4WnMlPJxy69cJqKxuYMm98LIRUDZGW3/GYMn6Z670HrQX6LytupbOQLte2mxKaXsyN9yv+4o4GK7K1gmbfmupUnGQzrtTqzueDbhd7cCYYVRmqMnQW+4PHgMeiQI1BXqDGUSjD4XBlEUfcvEl+AfTFOe1XjUCUyArqHQMjkFkSocAmnAByZaEgoq1RKZjCsqTzzSt/kvKKKkMm5MyxfvgCLediNNI53srvSDba4AzfEd04LIBvcdhSgpE7cSVDT8NpklclD4PQmnHMMR5N0Qk3wfDz+A5YvL8yyRBL0M0S/5EITeEyIUMREbpjoaNTL6stRNhuV/OibeI')))
@miratcan
miratcan / hrtool.py
Created Aug 19, 2016
A python script to run hackerrank answers on your local. Just run it in the sample test cases folder that you downloaded from hackerrank.
View hrtool.py
import re
import glob
import subprocess
from os.path import exists
from sys import exit
INPUT_FOLDER = 'input/'
OUTPUT_FOLDER = 'output/'
@miratcan
miratcan / logme
Last active Nov 29, 2018
logme: Simplest diary program written in python.
View logme
#!/usr/bin/env python
"""logme: Simplest diary program"""
__author__ = "Mirat Can Bayrak"
__copyright__ = "Copyright 2016, Planet Earth"
from datetime import datetime
View colors.py
import random
import subprocess
from collections import namedtuple
from datetime import timedelta
from math import sqrt
import argparse
from os.path import join, exists
from os import getcwd, mkdir
from ffprobe import FFProbe
from pytube import YouTube
@miratcan
miratcan / fblogin.py
Created Jan 2, 2016
FB Login Brute Force (Requires mechanize module)
View fblogin.py
import itertools
import sys
from time import sleep
import mechanize
CHRS = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
MOZILLA_UAS = 'Mozilla/5.0 (X11; U; Linux i686; en-US) ' \
'AppleWebKit/534.7 (KHTML, like Gecko) ' \
@miratcan
miratcan / get_first_or_create.py
Last active Aug 29, 2015
When you need to create a record of a model and delete duplicates same time you can use this method.
View get_first_or_create.py
def create_and_delete_others(cls, **kwargs):
"""
1. Get first record of model cls from db with given kwargs.
2. If found, update that record with update_params.
2. If not found, create instance with create_params.
3. If more than one found, delete others.
"""
create_params = kwargs.pop('create_params', {})
update_params = kwargs.pop('update_params', {})
save_params = kwargs.pop('save_params', {})
@miratcan
miratcan / filika
Last active Feb 29, 2016
Friendfeed backup tool without any package dependencies. Just download and run like: ./filika bret
View filika
#!/usr/bin/env python
__author__ = "Mirat Can Bayrak"
__email__ = "miratcanbayrak@gmail.com"
__copyright__ = "Copyright 2015, Planet Earth"
ENTRIES_PER_PAGE = 100
import re
import logging
You can’t perform that action at this time.