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
anonymous
anonymous / gist:161265
Created August 4, 2009 14:09
== Rules ==
On Infrastructure
-----------------
There is one system, not a collection of systems.
The desired state of the system should be a known quantity.
The "known quantity" must be machine parseable.
The actual state of the system must self-correct to the desired state.
The only authoritative source for the actual state of the system is the system.
The entire system must be deployable using source media and text files.
@ironcamel
ironcamel / SimpleRequest.java
Created October 27, 2010 04:14
This is a comparison of making a simple http request with basic/digest authentication in perl and java. I was porting a perl app to the android platform (java) and was struck by the different amount of complexity and effort required.
import java.io.BufferedReader;
import java.io.InputStreamReader;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.HttpRequest;
import org.apache.http.HttpResponse;
public class SimpleRequest {
@BYK
BYK / GHAPILanguageStats.js
Created July 11, 2011 07:42
Get language stats of your GitHub
window.getLangStats = function getLangStats(repos) {
var mapper = function(ent){return ent.language},
reducer = function(stats, lang) {stats[lang] = (stats[lang] || 0) + 1; return stats},
langStats = repos.map(mapper).reduce(reducer, {});
delete langStats['null'];
return Object.keys(langStats).sort(function(a,b){return langStats[b] - langStats[a]});
};
window.ghApiCallHandler = function(result) {
if (Math.floor(result.meta.status/100) == 2)
@JeffreyWay
JeffreyWay / gist:1525217
Created December 27, 2011 21:29
Instant Server for Current Directory
alias server='open http://localhost:8000 && python -m SimpleHTTPServer'
@paulrouget
paulrouget / es6.js
Last active October 6, 2015 07:07
Some ECMAScript 6 element are available in Firefox
// To test this code in Firefox, I encourage you to use Firefox Aurora
// and to include your script this way:
// <script type="application/javascript;version=1.8">
// (necessary to make `let` work)
/* let ********************************************* */
// let is the new var :)
// Declares a block scope local variable
@benvinegar
benvinegar / gist:3361951
Created August 15, 2012 17:54
List of websites that force anonymous visitors to sign in to view content indexed by Google
List of websites that force anonymous visitors to sign in to view content indexed by Google:
quora.com
estocksdaily.com
travelzoo.com
@NorthIsUp
NorthIsUp / fuel.py
Last active October 12, 2015 01:18
Reverse engineering of the nike fuel api to get your fuel
"""
Author: [email protected]
to run you will need to install the following:
pip install requests
pip install simplejson
get the auth token and device id by sniffing the nike app syncing
with api.nike.com with charles
@berkerpeksag
berkerpeksag / gist:4172064
Created November 29, 2012 21:34
Bir Git deposundaki herhangi bir dosyayı ya da klasörü tüm geçmişiyle beraber başka bir depoya taşımak
# Taşınacak depo
$ git log --pretty=email --patch-with-stat --reverse -- src/etc/vim/ > vim.patch
# Yeni depo
$ git init
$ git am < vim.patch

Snow in canvas land

Other people's code is awful, and your own code from months previous counts as someone else's. With this and the festive spirit in mind, I dug up a canvas snow demo I made two years ago to see how bad my code really was.

Turns out the performance landscape has changed quite a bit, but after applying a couple of workarounds, best practices, and memory management, I got the demo running smoother than it ever did.

Ugh, I can't believe I just wrote "performance landscape". Anyway...

How does the demo work?

@fajran
fajran / blogger-to-wordpress.py
Last active August 21, 2016 16:28
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