Skip to content

Instantly share code, notes, and snippets.

🚩
KubeCon mode, expect no reviews until 5/25

Ahmet Alp Balkan ahmetb

Block or report user

Report or block ahmetb

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 speedtest-registry-directly.sh
#!/bin/bash
set -e
image='tianon/speedtest'
layer='b31651d7665036bcf58a0b6b0d7aca173daff87b003ec50621cb0fde8d68864f'
# docker inspect b31651d7665036bcf58a0b6b0d7aca173daff87b003ec50621cb0fde8d68864f | grep '"Size"'
# "Size": 580580561,
# ("Content-Length: 228991341" though...)
token="$(curl -sSL -o /dev/null -D- -H 'X-Docker-Token: true' "https://index.docker.io/v1/repositories/$image/images" | awk -F ':[[:space:]]*|\r' '$1 == "X-Docker-Token" { print $2 }')"
@ahmetb
ahmetb / Mtim is updated
Last active Aug 29, 2015
50% chance Mtim field doesn't get updated
View Mtim is updated
root@e25213faeb41:/go/src/github.com/docker/docker# go test -v github.com/docker/docker/pkg/archive -run TestChangesDirsMutated
=== RUN TestChangesDirsMutated
--- PASS: TestChangesDirsMutated (0.11 seconds)
changes_test.go:208: Lstat(old): &{name:symlink2 size:7 mode:134218239 modTime:{sec:63551388019 nsec:33650046 loc:0x6f8f40} sys:0xc208048510}
changes_test.go:209: Lstat(new): &{name:symlink2 size:13 mode:134218239 modTime:{sec:63551388019 nsec:43652546 loc:0x6f8f40} sys:0xc208048630}
changes_test.go:210: sameFsTime=false, expected=false
changes_test.go:212: stat(old): &{Dev:34 Ino:171198 Nlink:1 Mode:41471 Uid:0 Gid:0 X__pad0:0 Rdev:0 Size:7 Blksize:4096 Blocks:0 Atim:{Sec:1415791219 Nsec:33650046} Mtim:{Sec:1415791219 Nsec:33650046} Ctim:{Sec:1415791219 Nsec:43652546} X__unused:[0 0 0]}
changes_test.go:213: stat(new): &{Dev:34 Ino:172134 Nlink:1 Mode:41471 Uid:0 Gid:0 X__pad0:0 Rdev:0 Size:13 Blksize:4096 Blocks:0 Atim:{Sec:1415791219 Nsec:43652546} Mtim:{Sec:1415791219 Nsec:43652546} Ctim:{Sec:14157
@ahmetb
ahmetb / Retry.cs
Last active Aug 29, 2015
Retry logic modified for our testing needs, see comments at the end
View Retry.cs
using System;
using System.Diagnostics;
using System.Threading.Tasks;
public class RetryLoop<TResult>
{
public RetryLoop(Func<RetryIterationContext<TResult>, Task<TResult>> func, Func<RetryIterationContext<TResult>, bool> succeeded)
{
this.func = func;
this.timer = new Stopwatch();
@ahmetb
ahmetb / tr.yml
Last active Dec 21, 2015 — forked from soffes/en.yml
roon.io Turkish strings
View tr.yml
tr:
viewer:
comment_on_twitter: "Twitter'da Yorum Yaz"
older: 'Daha Eskiler'
newer: 'Daha Yeniler'
feed: 'Feed'
share: 'Paylaş'
next_post: 'Sonraki Yazı'
previous_post: 'Önceki Yazı'
no_posts: 'Henüz bir yazı yazılmamış.'
@ahmetb
ahmetb / quora hack
Created Jul 13, 2013
clicks "Ask To Answer" Load More link a lot of times and finds people "Free to Ask" and clicks that button as well. I use that to get some initial free traction on my Quora questions.
View quora hack
var PAGE_LOAD_INTERVAL = 8000;
var TOTAL_PAGES = 30;
var VOTING_INTERVAL = 10*1000;
var k = 0;
var l = setInterval(function(){
$('.pager_next_link').trigger('click');
console.log('Loaded page ' + (++k));
}, PAGE_LOAD_INTERVAL);
@ahmetb
ahmetb / sloc.sh
Created Feb 17, 2013
Quick SLoC counter in CLI
View sloc.sh
# Counts source lines of code in current directory. Replace *.java with your source extension.
# (ignores empty lines)
find . -type f -name '*.java' -exec cat {} \; | sed '/^\s*$/d' | wc -l
# to ignore comments (in languages where comments start with #)
find . -type f -name '*.java' -exec cat {} \; | sed '/^\s*#/d;/^\s*$/d' | wc -l
@ahmetb
ahmetb / domains
Created Aug 26, 2012
List of gov.tr domain names I discovered (bulabildigim kadariyla bir gov.tr alan adlari listesi)
View domains
3158 GOV.TR domain names
http://ahmetalpbalkan.com/blog/gov-tr-alan-adlari-listesi/
==================================
100yilyy.gov.tr
19mayis.gov.tr
28kontrollab.gov.tr
360sakarya.gov.tr
80yilrehabilitasyon.gov.tr
9fi.gov.tr
@ahmetb
ahmetb / hack.sh
Created Mar 31, 2012 — forked from erikh/hack.sh
OSX For Hackers
View hack.sh
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@ahmetb
ahmetb / Secure.java
Created Feb 21, 2012
play secure module alternative
View Secure.java
package controllers;
import models.User;
import play.Logger;
import play.Play;
import play.libs.Crypto;
import play.mvc.Before;
import play.mvc.Controller;
import play.mvc.Http;
import play.mvc.Scope;
@ahmetb
ahmetb / gist:1520093
Created Dec 26, 2011
simple edge n-gram prefix filter
View gist:1520093
package service.search;
import java.io.Reader;
import org.apache.lucene.analysis.LowerCaseFilter;
import org.apache.lucene.analysis.LowerCaseTokenizer;
import org.apache.lucene.analysis.ReusableAnalyzerBase;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.Tokenizer;
import org.apache.lucene.analysis.WhitespaceTokenizer;
You can’t perform that action at this time.