Skip to content

Instantly share code, notes, and snippets.

View cfstras's full-sized avatar

Claus F. Strasburger cfstras

  • Düsseldorf, Germany
  • 13:02 (UTC +02:00)
View GitHub Profile
Sometimes, when adding a branch like so:
`fetch = path/to/branch:refs/remotes/git-svn/mynewbranch`
the path to the branch is mispelt.
You then go ahead and do a `$ git svn fetch` and git finds nothing. You realize what an incredible dolt you are and fix the path,
`fetch = realpath/to/branch:refs/remotes/git-svn/mynewbranch`
@RaymondMcGinlay
RaymondMcGinlay / unlock.py
Created June 11, 2013 13:07
Script for unlocking/locking Gnome desktop for by visiting a url with an authorised device, as seen in nFC unlocking demo. http://www.youtube.com/watch?feature=player_embedded&v=qRJSD93hRCQ
from bottle import route, run, request, static_file
import subprocess
"""
Get DEVICE_ID by running script and connecting to the url with your mobile device
python unlock.py
Bottle v0.11.2 server starting up (using WSGIRefServer())...
Listening on http://192.168.77.102:8888/
@alexspeller
alexspeller / base64encode.js.coffee
Last active December 21, 2015 04:38
Ember Table Extensions
# So, this is pretty horrible. If we just encode using btoa, any UTF-8 chars cause an error.
# If we use either of the workarounds on MDN[1], the £ sign is encoded wrong. I suspect
# Excel totally sucking at encodings is the reason why. So, the workaround is, to use
# the MDN workaround on chars with values > 255, and allow chars 0-255 to be encoded
# as is with btoa. Note that if you use either of the workarounds on MDN, chars
# 128-255 will be encoded as UTF-8, which includeds the £ sign. This will cause excel
# to choke on these chars. Excel will still choke on chars > 255, but at least the £
# sign works now...
# [1] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Base64_encoding_and_decoding
@k-takata
k-takata / gist:5124445
Last active July 17, 2020 16:50
Build The Silver Searcher

Build The Silver Searcher

the silver searcher

For Win32/64 using MSYS2

Install Packages

Install the following packages using pacman -S package-name:

@kylemanna
kylemanna / arch-linux-install.md
Last active April 19, 2023 04:40 — forked from binaerbaum/arch-linux-install
Minimal instructions for installing arch linux on an UEFI NVMe system with full system encryption using dm-crypt and luks
@leftclickben
leftclickben / gist:322b7a3042cbe97ed2af
Last active June 7, 2023 10:58
Steps to migrate from SVN to GitLab

Steps to migrate from SVN to GitLab

This process worked for me. I take no responsibility for any damage or loss incurred as a result of following or not following these steps or, for that matter, anything else you might do or not do.

Setup

  • SVN is hosted at svn.domain.com.au.
  • SVN is accessible via http (other protocols should work).
  • GitLab is hosted at git.domain.com.au and:
@cjus
cjus / jsonval.sh
Created June 26, 2011 17:42
Extract a JSON value from a BASH script
#!/bin/bash
function jsonval {
temp=`echo $json | sed 's/\\\\\//\//g' | sed 's/[{}]//g' | awk -v k="text" '{n=split($0,a,","); for (i=1; i<=n; i++) print a[i]}' | sed 's/\"\:\"/\|/g' | sed 's/[\,]/ /g' | sed 's/\"//g' | grep -w $prop`
echo ${temp##*|}
}
json=`curl -s -X GET http://twitter.com/users/show/$1.json`
prop='profile_image_url'
picurl=`jsonval`
@endolith
endolith / Readme.txt
Last active September 23, 2023 11:04
Gnome to Wine color scraper
This is a Python script to extract GNOME/GTK's color scheme and apply it to Wine, so that the themes (approximately) match.
Instructions:
1. Set your Gnome theme as you would like it
2. Run with a command like "python wine_colors_from_gtk.py"
3. Restart any apps running in Wine. They should match the Gnome theme colors now.
Better description with screenshots here: http://www.endolith.com/wordpress/2008/08/03/wine-colors/
This is also stored on https://code.launchpad.net/~endolith/+junk/wine-color-scraper
@innovia
innovia / kubernetes_add_service_account_kubeconfig.sh
Last active January 29, 2024 23:00
Create a service account and generate a kubeconfig file for it - this will also set the default namespace for the user
#!/bin/bash
set -e
set -o pipefail
# Add user to k8s using service account, no RBAC (must create RBAC after this script)
if [[ -z "$1" ]] || [[ -z "$2" ]]; then
echo "usage: $0 <service_account_name> <namespace>"
exit 1
fi
@cfstras
cfstras / _lima-on-m1.md
Last active January 30, 2024 17:11
Lima M1

Note (2024): I've used this for a while to get a reasonably workable Docker installation on my M1 MacBook. For simplicity I use colima nowadays. The setup below should still work though.


  1. Install lima
    brew install lima