Skip to content

Instantly share code, notes, and snippets.

View cbguder's full-sized avatar

Can Berk Güder cbguder

View GitHub Profile
@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-
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
RANGE=`expr "$CIRCLE_COMPARE_URL" : ".*compare\/\(.*\)"`
git log --oneline -i --grep "\[\(complete\|fix\|finish\).\+ #$1\]" $RANGE
@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)
@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 / 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"
from typing import Protocol, TypeVar, Generic, Any
T = TypeVar('T')
class Proxy(Generic[T]):
def __init__(self, proxied: T) -> None:
self._proxied = proxied