Skip to content

Instantly share code, notes, and snippets.

View carhartl's full-sized avatar

Klaus Hartl carhartl

View GitHub Profile
@carhartl
carhartl / update-git-remotes.sh
Last active June 23, 2022 15:13
Update git remotes within a workspace directory when you've renamed an organization
#!/bin/sh
#
# Assumes that the directory any repo was cloned to matches its name on GitHub,
# e.g. https://github.com/digitalservice4germany/java-application-template
# was cloned to a directory named "java-application-template".
#
# Run this in the (parent) directory where you want to update git remotes.
find "$PWD" -maxdepth 2 -type d | while read -r dir; do
cd "$dir" || exit
if [ -d .git ]; then
@carhartl
carhartl / album.rb
Last active August 29, 2015 14:20 — forked from rklemme/album.rb
require 'yaml'
Track = Struct.new :title, :duration
# An Album represents an audio medium which has title,
# interpret, a pause duration between tracks and a list
# of individual tracks.
class Album
attr_reader :title, :interpret, :pause
@carhartl
carhartl / uniq_input.rb
Last active January 7, 2016 16:30
Remove redundant substrings from list
input = %w(Bochum Stu Stut Stuttt Stutt Stuttgart Heesestr. Berl Berlin)
input.sort!.reverse.uniq { |s| input.grep(/\A#{s}/).last } # => ["Stuttt", "Stuttgart", "Heesestr.", "Bochum", "Berlin"]
@carhartl
carhartl / postgis.rb
Created January 12, 2016 13:59
Monkey-patching brew formulas for installing postgres 9.4 + postgis 2.1.7
class Postgis < Formula
desc "Adds support for geographic objects to PostgreSQL"
homepage "http://postgis.net"
url "http://download.osgeo.org/postgis/source/postgis-2.1.7.tar.gz"
sha256 "00ab79a3f609d7ea458f6fc358032ad059cb720baf88285243d6436a597a7ec2"
revision 1
def pour_bottle?
# Postgres extensions must live in the Postgres prefix, which precludes
# bottling: https://github.com/Homebrew/homebrew/issues/10247
@carhartl
carhartl / cartodb-utils.py
Created March 24, 2016 14:57 — forked from andrewxhill/cartodb-utils.py
command-line python interface for manipulating data on CartoDB
import os
import urllib
import urllib2
import base64
import json
import sys
import argparse
try:
import requests
except ImportError:

Keybase proof

I hereby claim:

  • I am carhartl on github.
  • I am carhartl (https://keybase.io/carhartl) on keybase.
  • I have a public key whose fingerprint is E232 B27A 7789 83C6 B383 C981 F4DA 8A9F 83F7 395E

To claim this, I am signing this object:

@carhartl
carhartl / autoenv.rb
Created November 10, 2016 18:53
Patched autoenv Homebrew formula
class Autoenv < Formula
desc "Per-project, per-directory shell environments"
homepage "https://github.com/kennethreitz/autoenv"
url "https://github.com/kennethreitz/autoenv/archive/v0.2.1.tar.gz"
sha256 "d10ee4d916a11a664453e60864294fec221c353f8ad798aa0aa6a2d2c5d5b318"
head "https://github.com/kennethreitz/autoenv.git"
bottle :unneeded
devel do
@carhartl
carhartl / terraform.rb
Last active February 27, 2018 18:06
Brew Terraform 0.10.8
require "language/go"
class Terraform < Formula
desc "Tool to build, change, and version infrastructure"
homepage "https://www.terraform.io/"
url "https://github.com/hashicorp/terraform/archive/v0.10.8.tar.gz"
sha256 "b076726f00b0488fc95bb041e982cb6aeaf280395d31f322017dd143bbabd7c4"
head "https://github.com/hashicorp/terraform.git"
bottle do
@carhartl
carhartl / Hyper.terminal
Last active February 17, 2023 15:05
Hyper like Terminal theme + settings
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ANSIBlueColor</key>
<data>
YnBsaXN0MDDUAQIDBAUGBwpYJHZlcnNpb25ZJGFyY2hpdmVyVCR0b3BYJG9iamVjdHMS
AAGGoF8QD05TS2V5ZWRBcmNoaXZlctEICVRyb290gAGjCwwTVSRudWxs0w0ODxARElVO
U1JHQlxOU0NvbG9yU3BhY2VWJGNsYXNzSDAgMC40IDEAEAKAAtIUFRYXWiRjbGFzc25h
bWVYJGNsYXNzZXNXTlNDb2xvcqIWGFhOU09iamVjdAgRGiQpMjdJTFFTV11kand+h4mL
@carhartl
carhartl / Hyper.itermcolors
Created September 11, 2019 10:43
iTerm2 Hyper Theme
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.0</real>