Skip to content

Instantly share code, notes, and snippets.

View kwk's full-sized avatar

Konrad Kleine kwk

View GitHub Profile
@bjaglin
bjaglin / remove-orphan-images.sh
Last active March 31, 2024 22:54
Remove orphan layers left by the "file" storage backend of the docker registry, heavily inspired by https://gist.github.com/shepmaster/53939af82a51e3aa0cd6
#!/bin/bash
set -eu
shopt -s nullglob
readonly base_dir=/var/lib/docker/registry
readonly output_dir=$(mktemp -d -t trace-images-XXXX)
readonly jq=/usr/bin/jq
readonly repository_dir=$base_dir/repositories
#!/bin/bash
set -eu
shopt -s nullglob
readonly base_dir=/var/local/docker-registry
readonly output_dir=$(mktemp -d -t trace-images-XXXX)
readonly jq=/tmp/jq
readonly repository_dir=$base_dir/repositories
@gnarf
gnarf / ..git-pr.md
Last active April 12, 2024 22:00
git pr - Global .gitconfig aliases for Pull Request Managment

Install

Either copy the aliases from the .gitconfig or run the commands in add-pr-alias.sh

Usage

Easily checkout local copies of pull requests from remotes:

  • git pr 4 - creates local branch pr/4 from the github upstream(if it exists) or origin remote and checks it out
  • git pr 4 someremote - creates local branch pr/4 from someremote remote and checks it out
@kwk
kwk / CMakeLists.txt
Last active February 14, 2024 08:53
Fix for "undefined reference to dlopen" in CMake projects
project(testlink)
add_executable(testlink main.cpp)
target_link_libraries(testlink)
@kwk
kwk / check-php-syntax.sh
Created September 16, 2011 10:08
Check PHP-files (added/modified/removed/or unknown) in Mercurial for PHP-Syntax errors
for i in `hg st --no-status $(hg root)`; do mimetype $i | grep php > /dev/null && php -l $i; done
@kwk
kwk / gist:1167959
Created August 24, 2011 12:29
How to install NodeJS and NPM on a host without internet access and without compile tools
# On build host (has internet access): Download and install NodeJS and NPM
wget http://nodejs.org/dist/node-v0.4.10.tar.gz
tar xvzf node-v0.4.10.tar.gz
cd node-v0.4.11
./configure
make
sudo make install
wget http://npmjs.org/install.sh
sudo sh ./install.sh
@Munter
Munter / install_assetgraph.sh
Created July 12, 2011 22:28
Assetgraph bootstrap
#!/bin/sh
# Install dependencies
sudo apt-get install git libssl-dev libcairo2-dev libgif-dev libjpeg8-dev optipng pngcrush pngquant
# Install Node.js v0.4
git clone git://github.com/joyent/node
cd node
git checkout v0.4
make distclean # Only necessary if you've compiled from the same checkout before