Skip to content

Instantly share code, notes, and snippets.

@miratcan
miratcan / annotated_turkish_syllables.py
Last active February 12, 2024 23:21
Python'da Türkçe Heceleme Yapma
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 / fblogin.py
Created January 2, 2016 10:06
FB Login Brute Force (Requires mechanize module)
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 / game_tester.lua
Last active October 27, 2023 12:34
Run tests on game before start on TIC-80
local testRunner = {
tests = {
test_foo = function() end,
test_bar = function() end,
test_zoo = function() end
},
init = function(self)
self._tests = {}
for n, f in pairs(self.tests) do
table.insert(self._tests, {n, f})
@miratcan
miratcan / blockchain.py
Last active September 22, 2023 12:33
Blockchain with Python
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 / fix_database_to_utf8.py
Last active August 31, 2023 00:06
Small python script that converts character sets to utf8 in all databases and tables. My solution for "Illegal mix of collations" errors. (http://stackoverflow.com/questions/3029321/how-to-solve-illegal-mix-of-collations-in-mysql)
from MySQLdb import connect
conn = connect(user="[USER]", passwd= "[PASSWORD]")
cur = conn.cursor()
cur.execute("show databases;")
dbs_to_update = filter(
lambda db: db not in ('information_schema', 'mysql', 'performance_schema'),
[dbname[0] for dbname in cur.fetchall()])
@miratcan
miratcan / komikaze.py
Created June 30, 2011 18:34
a Crawler for komikaze.net
"""
Mirat Can Bayrak / 2009
"""
from urllib import urlopen, urlretrieve
from datetime import date as Date
from datetime import timedelta
from xml.dom import minidom
from os.path import basename
import re
@miratcan
miratcan / setup_a_new_mac_for_python_development.sh
Last active July 10, 2023 08:27
Setup a New Mac For Development
brew install iterm2 git docker docker-compose btop neovim nvm pyenv pipx zsh zsh-completions wget grep curl tmux ranger
@miratcan
miratcan / hrtool.py
Created August 19, 2016 10:45
A python script to run hackerrank answers on your local. Just run it in the sample test cases folder that you downloaded from hackerrank.
import re
import glob
import subprocess
from os.path import exists
from sys import exit
INPUT_FOLDER = 'input/'
OUTPUT_FOLDER = 'output/'
@miratcan
miratcan / ubuntu.py
Created October 27, 2011 09:21 — forked from uugr/ubuntu.py
Ubuntu System Information Script. Prints sysinfo on terminal
#!/usr/bin/env python
#
# archey [version 0.1-11]
#
# Maintained by Melik Manukyan <melik@archlinux.us>
# Distributed under the terms of the GNU General Public License v3.
# See http://www.gnu.org/licenses/gpl.txt for the full license text.
#
# System information tool for Archlinux written in python.
#-----------------Customized For Ubuntu----------------------------
@miratcan
miratcan / extract_palette.py
Last active March 18, 2022 13:12
Extracts number palette data from videos and generates art from them.
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