Skip to content

Instantly share code, notes, and snippets.

View cmur2's full-sized avatar

Christian Nicolai cmur2

View GitHub Profile
@putnamhill
putnamhill / docker-rmi-interactive.sh
Last active January 4, 2024 13:40
A script to help clean up docker images interactively
#!/bin/bash
agree() {
local question="$1"
while true; do
read -p "$question " answer
case $answer in
[Yy]|[Yy][Ee][Ss]) return 0 ;;
[Nn]|[Nn][Oo]|'') return 1 ;; # empty string is default
@n-st
n-st / pre-commit
Created August 9, 2015 13:07
Git pre-commit hook: Reject commit if a DNS zone file has been changed without changing its SOA serial. The serial needs to be on a separate line that contains ' ; serial'.
#!/bin/bash
# Check if all changed zone files have had their SOA serial incremented.
if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else
# Initial commit: diff against an empty tree object
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
@hbrysiewicz
hbrysiewicz / ember.css
Last active January 9, 2020 13:19
Ember.js Theme for Reveal.js - Based off of the Simple Theme
@import url(https://fonts.googleapis.com/css?family=Open+Sans:300,600,300italic,700italic);
/**
* A simple theme for reveal.js presentations, similar
* to the default theme. The accent color is rgb(242, 56, 24).
*
* This theme is Copyright (C) 2012 Owen Versteeg, https://github.com/StereotypicalApps. It is MIT licensed.
* reveal.js is Copyright (C) 2011-2012 Hakim El Hattab, http://hakim.se
*/
/*********************************************
* GLOBAL STYLES
@op8867555
op8867555 / input.lua.patch
Created June 28, 2014 03:41
don't starve ( linux ) xbox 360 controller prompt dirty hack
--- input.lua.bak 2014-06-28 10:13:51.897841317 +0800
+++ input.lua 2014-06-28 11:38:07.049859004 +0800
@@ -295,6 +295,10 @@
if not (nil == intParam) then
text = string.format(text, intParam)
end
+
+ for key, rename in pairs(STRINGS.UI.CONTROLSSCREEN.GENERIC_CONTROLLER_RENAMES) do
+ text = string.gsub(text, key, rename)
+ end
@mariussturm
mariussturm / gist:061b9f4861ef1292aa60
Last active February 1, 2017 13:16
How to pair Firefox 29 with Owncloud's mozilla_sync / Weave
_Go to your Owncloud installation <https://myowncloud/remote.php/mozilla_sync> and accept the SSL Certificate
_Open about:config
_Create: services.sync.username <string> the value should be a hash not the username itself. (You only need the hash if the
sync was setup with a pre FF29, if you start from scratch the string doesn't matter)
You can look this up in an older browser or in the logs of your Owncloud server!!
_Go to: Preferences -> Sync -> Setup Firefox sync (you should see the old UI now)
'I Have an Account'
'I don't have the device with me'
'Account' - again use the hash NOT the actual username!
@wu-lee
wu-lee / gist:9274194
Created February 28, 2014 16:31
Using Apache as s CORS-handling proxy to a CouchDB server
<IfModule !proxy_module>
LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so
</IfModule>
<IfModule !proxy_http_module>
LoadModule proxy_http_module /usr/lib/apache2/modules/mod_proxy_http.so
</IfModule>
<IfModule !headers_module>
LoadModule headers_module /usr/lib/apache2/modules/mod_headers.so
@hubgit
hubgit / README.md
Last active May 2, 2024 10:55
Remove metadata from a PDF file, using exiftool and qpdf. Note that embedded objects may still contain metadata.

Anonymising PDFs

PDF metadata

Metadata in PDF files can be stored in at least two places:

  • the Info Dictionary, a limited set of key/value pairs
  • XMP packets, which contain RDF statements expressed as XML

PDF files

@rodneyrehm
rodneyrehm / anti-keygrabber.user.js
Last active July 5, 2022 01:31
GreaseMonkey: Prevent Web Applications From Grabbing Certain HotKeys
// ==UserScript==
// @name anti key-grabber
// @description Prevent web apps from capturing and muting vital keyboard shortcuts
// @grant none
// @version 1.1
// ==/UserScript==
(function(){
var isMac = unsafeWindow.navigator.oscpu.toLowerCase().contains("mac os x");
unsafeWindow.document.addEventListener('keydown', function(e) {
if (e.keyCode === 116) {
@KartikTalwar
KartikTalwar / Documentation.md
Last active May 9, 2024 12:59
Rsync over SSH - (40MB/s over 1GB NICs)

The fastest remote directory rsync over ssh archival I can muster (40MB/s over 1gb NICs)

This creates an archive that does the following:

rsync (Everyone seems to like -z, but it is much slower for me)

  • a: archive mode - rescursive, preserves owner, preserves permissions, preserves modification times, preserves group, copies symlinks as symlinks, preserves device files.
  • H: preserves hard-links
  • A: preserves ACLs
@abstraktor
abstraktor / string.rb
Created February 3, 2012 12:35
rotX with ruby
# when you guessed a letter
# rotate("ammi://zbmanu.vhf/tulmktdmhk", "h".ord - "a".ord)
def rotate(str, num)
str.chars.map{|c| (c.ord<97) ? c: ((c.ord+num - 97)%26 + 97).chr}.join("")
end