Skip to content

Instantly share code, notes, and snippets.

View dogancelik's full-sized avatar

Doğan Çelik dogancelik

View GitHub Profile
@dogancelik
dogancelik / minecraft.sh
Created March 6, 2014 13:53
(Bash) Minecraft Multi Launcher
#!/bin/bash
export LD_LIBRARY_PATH=/usr/lib/jvm/java-7-oracle/jre/lib/amd64
# /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64
export OPT1="Start Minecraft Launcher"
export OPT2="Start Technic Launcher"
export OPT3="Start Magic Launcher"
export OPT4="Quit"
@dogancelik
dogancelik / update-node.js
Created July 1, 2014 20:11
(Windows) Update Node.js (64-bit version) (No download if versions match)
var http = require('http');
var fs = require('fs');
var child_process = require('child_process');
var pageUrl = "http://nodejs.org/download/";
var downloadUrlRegex = /http:\/\/nodejs\.org\/dist\/v[0-9\.]+\/x64\/node-(v[0-9\.]+)-x64\.msi/i;
var downloadUrl;
var downloadVersion;
var pageSource;
var filePath = "node.msi";
@dogancelik
dogancelik / DecodeNDT.cs
Last active September 25, 2015 20:07
(C#) DecodeNDT
/*
* Project Name: DecodeNDT
* Descripton: Decodes NDT files from Atlantica Online
* Ported from Python to C# by Doğan Çelik
* Originally from: http://bit.ly/kilEew
*/
using System;
using System.Collections.Generic;
using System.Text;
@dogancelik
dogancelik / bolum.php
Last active October 2, 2015 13:28
(PHP) TheTVDB API Example
<?php
/*
* Written by: Doğan Çelik
* Description: Exports a list of episode names from a specified season from a specified series from TheTVDB
* A demo is available at http://dogancelik.com/dizi/
* How to use: Request this page bolum.php?d=NAME_OF_THE_SERIES&s=SEASON_NUMBER
*/
//error_reporting(E_ALL);
@dogancelik
dogancelik / Open In Browser.py
Last active October 5, 2015 13:57
(Sublime Text) How to view/open file in browser in Sublime Text 2?
import sublime, sublime_plugin
import webbrowser
class OpenInBrowser(sublime_plugin.TextCommand):
def run(self, edit):
webbrowser.open(self.view.file_name())
@dogancelik
dogancelik / gist:5521559
Last active December 17, 2015 00:29
(Python) timeit for "check object if it's a list"
import timeit
# Tested on Python 2.7.5 (64-bit)
t = timeit.Timer(stmt="isinstance(['a', 1], types.ListType)", setup="import types")
print t.timeit() # 0.310844602274
t = timeit.Timer(stmt="isinstance(['a', 1], list)")
print t.timeit() # 0.313751077743
@dogancelik
dogancelik / gist:5541173
Last active December 17, 2015 03:09
(Python) timeit for zeroing time attributes in a datetime object
import timeit
t = timeit.Timer(stmt="datetime.datetime(*datetime.datetime.now().date().timetuple()[:6])", setup="import datetime")
print t.timeit() # 4.80428367916
t = timeit.Timer(stmt="datetime.datetime.combine(datetime.datetime.now().date(), datetime.time(0, 0, 0))", setup="import datetime")
print t.timeit() # 3.23761676673
@dogancelik
dogancelik / gist:5650542
Last active December 17, 2015 18:08
(Python) timeit for getting filename without extension
import timeit
t = timeit.Timer(stmt="splitext(__file__)[0]", setup="from os.path import splitext")
print t.timeit() # 2.1748800403
t = timeit.Timer(stmt="__file__[:-3]")
print t.timeit() # 0.110901126177
t = timeit.Timer(stmt='__file__[:__file__.rindex(".")]')
print t.timeit() # 0.387404180721
@dogancelik
dogancelik / bleach_parse.coffee
Created August 7, 2013 12:36
(PhantomJS) Parse Bleach episodes in Wikipedia
page = require('webpage').create()
fs = require 'fs'
system = require 'system'
page.onConsoleMessage = (msg) -> console.log(msg)
page.open "http://en.wikipedia.org/wiki/Bleach_episodes", (status) ->
csv = page.evaluate ->
formatDate = (date) ->
date.getFullYear() + "-" + ((if date.getMonth() < 9 then "0" else "")) + (date.getMonth() + 1) + "-" + ((if date.getDate() < 10 then "0" else "")) + date.getDate()
@dogancelik
dogancelik / google-search.xml
Created February 7, 2016 01:55
Google Search OpenSearch Plugin
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/" xmlns:moz="http://www.mozilla.org/2006/browser/search/">
<ShortName>Google Search</ShortName>
<Description>Google Encrypted Search</Description>
<InputEncoding>UTF-8</InputEncoding>
<Image width="32" height="32" type="image/png">data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAEHklEQVRYhb2WXWwUVRTH56XBotQn33wQBXlTov3gQWtErKB9IGkptPYBxYox6INRa0LQQELRYqEJ8NAPLMQ0bCuBVqzQZhGpH91YJGYJaYMW0O1XZnb6xc7u7Nxz9u+D203vzGx3tlZPcl723j2///m4d66ieDRd1/OIqIqIWolokJl1ZraSHiaiweRapa7reV7jZjTTNNcRURszx+DRmDlKRCdN01y7ZDCAlUKIBmYmr2AXIUIIcTgUCuVmm/XjzHxzqWAXIUHTNNd4gluW9RQza26BaHwURvsXmHn/bYS3bYZasgHqi0UIl5Vg+r23YJxuBo3+lU6ECmC9l8wdcJoYw+z+j6BuKoT6QsHivqkQs598CJoYcxWRthKTk5P3u5U91tcD7ZXizGCba6XPwbzS59oO15kQQjTYNxtnTmUNXuhz9ftd2yGEqLeXfp192mN9PWkDT9VUItJyDLFvziHWcx6RluOYerNKhh+pAxKJdPMgpFYQUZvU8/FRaC8/6wDr1VsRvxZwDQoA8cEBhHeU4t7xz9PuSTGIWhVFURQAD9ovmUjjOw749J7XkJibyxg4YUQy7gEAZjY0TVulEFGVFCA6AtG7ArO1j6Tg4W2bwTNTngJnY0S0XSGiVknZnToIfw6EP