Skip to content

Instantly share code, notes, and snippets.

View ahmetb's full-sized avatar
🛑
Slow to respond

Ahmet Alp Balkan ahmetb

🛑
Slow to respond
View GitHub Profile
@ahmetb
ahmetb / -
Created December 12, 2015 00:07
#cloud-config
disable_root: false
manage_etc_hosts: true
# The modules that run in the 'init' stage
cloud_init_modules:
- migrator
- ubuntu-init-switch
- seed_random
- bootcmd
@ahmetb
ahmetb / sloc.sh
Created February 17, 2013 22:21
Quick SLoC counter in CLI
# 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 / quora hack
Created July 13, 2013 20:59
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.
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 / tr.yml
Last active December 21, 2015 18:49 — forked from soffes/en.yml
roon.io Turkish strings
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 / keybase.md
Last active September 14, 2016 17:40

Keybase proof

I hereby claim:

  • I am ahmetalpbalkan on github.
  • I am alp (https://keybase.io/alp) on keybase.
  • I have a public key whose fingerprint is BF91 C773 DD1E 2E87 AFE9 616F F84A 66B2 CBC2 9F60

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am ahmetb on github.
  • I am alp (https://keybase.io/alp) on keybase.
  • I have a public key ASB3Us2SJzEmVMqSFuc4nHcOh1xbv3QZfwp0Izayulo8vgo

To claim this, I am signing this object:

@ahmetb
ahmetb / _README.md
Created May 27, 2018 05:02
BSD grep segmentation fault

I'm getting garbage characters on my screen and eventually segmentation fault from BSD grep "2.5.1-FreeBSD".

Repro

Download attached files and run:

/usr/bin/grep -E --color -f dirs_pattern.txt rp_dirs_used_in_deps.txt

@ahmetb
ahmetb / tmux.md
Created December 18, 2017 05:49 — forked from andreyvit/tmux.md
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@ahmetb
ahmetb / pelican-frontmatter-to-hugo.sh
Created October 21, 2019 04:36
convert pelican frontmatter (YAML) to hugo (YAML) by adding --- separators
# prepend --- to every doc
sed -i '1i---' *.md
# append --- to first empty line (\n\n)
# (use GNU sed)
sed -i '0,/^$/s//---\n/' *.md
@ahmetb
ahmetb / list-archive-files.sh
Created November 7, 2019 05:57
list all files in archives hosted in a krew-index (run from repo root)
#!/bin/bash
set -euo pipefail
files=$( grep -hRE '\.(tar\.gz|zip)' plugins/* | \
sed -E 's/^\s+(-\ )?uri:\s//g' | \
sed -E 's/"//g' | \
sort | \
uniq )
for f in $files; do