Skip to content

Instantly share code, notes, and snippets.

View BYK's full-sized avatar
🔦
Helping engineers help themselves help us all

Burak Yigit Kaya BYK

🔦
Helping engineers help themselves help us all
View GitHub Profile
@BYK
BYK / i18n.js
Created February 27, 2014 11:08
grunt.registerTask(
'translations.install',
'Installs Transifex client, tx for other translation tasks. Usually requires `sudo`.',
function () {
var done = this.async();
grunt.util.spawn({
cmd: 'easy_install',
args: ['transifex-client']
}, function (error, result, code) {
@BYK
BYK / tld_python.sh
Last active August 29, 2015 14:03
Fetch the most current list of TLDs and create a Python module from them
echo 'TLDS = (' > $1 &&
curl -f -sS https://data.iana.org/TLD/tlds-alpha-by-domain.txt -L |
awk '{print tolower($0)}' |
grep '^[[:alnum:]\-]\{1,63\}$' | sed 's/^.*$/"&",/g' >> $1 &&
echo ')' >> $1
@BYK
BYK / Instructions.md
Last active August 29, 2015 14:15
KindleIt Manifest for Firefox Share
  1. Go to about:config in your Firefox
  2. Right click
  3. New -> String
  4. Name: social.manifest.fivefilters-org
  5. Value: contents of social.manifest.fivefilters-org.raw.json below
  6. Type social.activeProviders in the search box in the config page
  7. Double click on the result
  8. Add ,"http://fivefilters.org":1 right before } in the value
  9. Enter
  10. Restart your Firefox and use the FiveFilters icon showing up when you click on the paper plane share icon
@BYK
BYK / djb2.js
Last active December 26, 2015 03:49 — forked from anonymous/djb2.sql
Compatible DJB2 Hash implementation in JS and SQL
function djb2Hash(str, seed) {
for (var counter = 0, len = str.length; counter < len; counter++) {
seed ^= (seed << 5);
seed ^= str.charCodeAt(counter);
}
// We discard the sign-bit for compatibility with the DB implementation
// and "always positive integers"
return seed & ~(1 << 31);
}
@BYK
BYK / escape_args.php
Last active April 12, 2016 14:27
Process call argument escaping on Windows with PHP
<?php
/**
* Escapes a single argument to be glued together and passed into
* CreateProcess on Windows through `proc_open`.
*
* Adapted from https://blogs.msdn.microsoft.com/twistylittlepassagesallalike/2011/04/23/everyone-quotes-command-line-arguments-the-wrong-way/
*
* @param string The argument to be escaped
* @result string Escaped argument that can be used in a CreateProcess call
*/
@BYK
BYK / sudoku.py
Last active April 24, 2016 00:59
class SudokuSolver(object):
def __init__(self, n=3):
self.n = n
self.size = self.n * self.n
self.matrix = [
[set(range(1, self.size+1)) for i in range(self.size)] for
j in range(self.size)
]
def show(self):
@BYK
BYK / keybase.md
Created June 16, 2016 12:10
Verifying myself on Keybase

Keybase proof

I hereby claim:

  • I am BYK on github.
  • I am byk (https://keybase.io/byk) on keybase.
  • I have a public key whose fingerprint is 70DB C4D9 5802 6B46 032E AB75 A17E E621 C962 DE46

To claim this, I am signing this object:

@BYK
BYK / blogger-to-wordpress.py
Last active August 21, 2016 16:29 — forked from fajran/blogger-to-wordpress.py
A Blogger's backup file to WordPress' WXR converter.Only tested with posts and comments, and NOT with pages. May not be efficient for huge blogs since the script keep all content in the memory during conversion.Released as public domain.
# Blogger's backup file to WordPress' WXR converter.
#
# Only tested with posts and comments, and NOT with pages.
# May not be efficient for huge blogs since the script keep
# all content in the memory during conversion.
#
# Released as public domain.
#
# Please note that I converted the labels in Blogspot
# as tags in WordPress. I also hardcoded two categories for the
import itertools
import operator
get_branches = lambda: [branch[1:].strip() for branch in $(git branch --list).split('\n') if branch]
get_remotes = lambda: dict((k, set(v[1] for v in group)) for k, group in itertools.groupby(branch.split('->')[0].split('/') for branch in $(git branch -r).split(), operator.itemgetter(0)) if k)
@BYK
BYK / hurriyet.js
Created January 13, 2015 09:49
Hurriyet.com.tr Galeri Duzlestirici
var fullContent = [];
var contentContainer = document.querySelector('div.gBigOverlay');
contentContainer.innerHTML = '<img style="display: block; width: 16px; height: 16px; margin: 45% auto" src="' +
'data:image/gif;base64,R0lGODlhEAAQAPIAAP///wAAAMLCwkJCQgAAAGJiYoKCgpKSkiH+GkNyZWF0ZWQgd2l0aCBhamF4bG9hZC5pbmZvACH5BAAKAAAAIf8LTkVUU0NBUEUyLjADAQAAACwAAAAAEAAQAAADMwi63P4wyklrE2MIOggZnAdOmGYJRbExwroUmcG2LmDEwnHQLVsYOd2mBzkYDAdKa+dIAAAh+QQACgABACwAAAAAEAAQAAADNAi63P5OjCEgG4QMu7DmikRxQlFUYDEZIGBMRVsaqHwctXXf7WEYB4Ag1xjihkMZsiUkKhIAIfkEAAoAAgAsAAAAABAAEAAAAzYIujIjK8pByJDMlFYvBoVjHA70GU7xSUJhmKtwHPAKzLO9HMaoKwJZ7Rf8AYPDDzKpZBqfvwQAIfkEAAoAAwAsAAAAABAAEAAAAzMIumIlK8oyhpHsnFZfhYumCYUhDAQxRIdhHBGqRoKw0R8DYlJd8z0fMDgsGo/IpHI5TAAAIfkEAAoABAAsAAAAABAAEAAAAzIIunInK0rnZBTwGPNMgQwmdsNgXGJUlIWEuR5oWUIpz8pAEAMe6TwfwyYsGo/IpFKSAAAh+QQACgAFACwAAAAAEAAQAAADMwi6IMKQORfjdOe82p4wGccc4CEuQradylesojEMBgsUc2G7sDX3lQGBMLAJibufbSlKAAAh+QQACgAGACwAAAAAEAAQAAADMgi63P7wCRHZnFVdmgHu2nFwlWCI3WGc3TSWhUFGxTAUkGCbtgENBMJAEJsxgMLWzpEAACH5BAAK