Skip to content

Instantly share code, notes, and snippets.

View cbguder's full-sized avatar

Can Berk Güder cbguder

View GitHub Profile
from typing import Protocol, TypeVar, Generic, Any
T = TypeVar('T')
class Proxy(Generic[T]):
def __init__(self, proxied: T) -> None:
self._proxied = proxied
@cbguder
cbguder / timed.zsh
Last active February 3, 2022 21:11
Write command timings to CSV file
# Requires GNU time
timed() {
local ts=$(date "+%FT%T%z" | tr -d "\n")
gtime --quiet -o "${HOME}/.timed" -a -f "${ts},%e,%C" -- $@
}
alias git="timed git"
@cbguder
cbguder / Gemfile
Created November 15, 2016 04:05
Group Foursquare bookmarks into lists by city
source "https://rubygems.org"
gem "rest-client"
gem "awesome_print"
@cbguder
cbguder / add_key.sh
Last active January 10, 2017 00:42
Add SSH keys
#!/bin/bash
set -e
LOCATION=$(cd `dirname $0`; pwd)
VOLUME=$(df -P $0 | awk 'NR!=1 {print $NF}')
DURATION="$1"
if [ -z "$DURATION" ]; then
NOW=$(date +%s)
RANGE=`expr "$CIRCLE_COMPARE_URL" : ".*compare\/\(.*\)"`
git log --oneline -i --grep "\[\(complete\|fix\|finish\).\+ #$1\]" $RANGE
function goto() {
local p
local f
for p in `echo $GOPATH | tr ':' '\n'`; do
f=`find ${p}/src -maxdepth 3 -type d | grep ${1} | head -n 1`
if [ -n "$f" ]; then
cd $f
return
fi
@cbguder
cbguder / axifier.sh
Last active August 29, 2015 14:21
Sort lines by length
sed 's/ *$//' | sort | awk '{print length, $0}' | sort -nrs | cut -d' ' -f2-
@cbguder
cbguder / Rakefile
Last active December 18, 2015 05:29 — forked from avh4/Rakefile
PROJECT_NAME = "AwesomeThing"
APP_NAME = "AwesomeThing"
@configuration = "Debug"
@app_suffix = "-Dev"
@staging_developer_name = "iPhone Developer: <<FILL ME IN>>"
@staging_provisioning_profile = "Support/AwesomeThing.mobileprovision"
@production_developer_name = "iPhone Distribution"
@production_provisioning_profile = "Support/AwesomeThing.mobileprovision"
@appstore_developer_name = "iPhone Distribution"
@appstore_provisioning_profile = "Support/AwesomeThing.mobileprovision"
javascript:window.location=$("#left-stack img.artwork").attr("src").replace("170x170", "1200x1200")
@cbguder
cbguder / .rtorrent.rc
Created November 11, 2011 20:53
Growl notifier for rTorrent
system.method.set_key = event.download.finished,notify_finished,"execute=rtorrentNotify,--finished,$d.get_name="
system.method.set_key = event.download.inserted_new,notify_inserted_new,"execute=rtorrentNotify,--inserted-new,$d.get_name="