Skip to content

Instantly share code, notes, and snippets.

View robindegen's full-sized avatar

Robin 'Ruadeil' Degen robindegen

View GitHub Profile
git remote add all host1:path/proj.git
git remote set-url --add all host2:path/proj.git
git remote set-url --add all host3:path/proj.git
@robindegen
robindegen / SQL row to columns.sql
Created June 8, 2020 15:27
SQL row to columns
select Parts.Id, Parts.Name, Parts.CreatedTimestamp,
MAX(CASE WHEN Key = "TEST" THEN Value END) test_key,
MAX(CASE WHEN Key = "ANOTHER" THEN Value END) another_key
from parts
left outer join Properties P on Parts.Id = P.PartId
group by Parts.Id
@robindegen
robindegen / mysql_store_use_result_stmt_cursor.c
Created January 14, 2020 06:30 — forked from hoterran/mysql_store_use_result_stmt_cursor.c
mysql api example, include store_result, use_result, stmt, server cursor , fetch row setting
#include <stdio.h>
#include <mysql.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
int main (int argc, char *argv[]) {
MYSQL *mysql;
MYSQL_RES *result;
@robindegen
robindegen / gist:124b68fdfc820391794a7be9efcfe4e1
Created January 8, 2019 13:19
Find large objects in a git repo
git rev-list --objects --all \
| git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' \
| sed -n 's/^blob //p' \
| sort --numeric-sort --key=2 \
| cut -c 1-12,41- \
| $(command -v gnumfmt || echo numfmt) --field=2 --to=iec-i --suffix=B --padding=7 --round=nearest
sudo xcode-select --switch /Applications/Xcode-beta.app/Contents/Developer
@robindegen
robindegen / gist:c9cfdccd5e18557f90e8eef058e6b096
Created January 25, 2018 14:54
Git rebase date/time cleanup
git commit --amend --reset-author --no-edit
@robindegen
robindegen / gist:2a1aad6767006fa0e8cc57321f61781f
Created September 24, 2017 16:20
Allow running downloaded apps from anywhere (macOS)
sudo spctl --master-disable
@robindegen
robindegen / cue_to_mp3.py
Created June 17, 2016 08:33 — forked from bancek/cue_to_mp3.py
CUE splitter using ffmpeg (to mp3)
cue_file = 'file.cue'
d = open(cue_file).read().splitlines()
general = {}
tracks = []
current_file = None
@robindegen
robindegen / gist:7691c79e21ba85cf254c
Created October 21, 2015 05:07
Add spacer to osx dock
defaults write com.apple.dock persistent-apps -array-add '{"tile-type"="spacer-tile";}'; killall Dock