Skip to content

Instantly share code, notes, and snippets.

@hacklschorsch
hacklschorsch / mysql_backup_cron
Created December 5, 2011 10:28
Rolling MySQL snapshots in two lines of code
# Scope: Back up the MySQL database
# Author: Florian Sesser <[email protected]>
# Date: 2011-11-11, 2011-12-05
# This script is to be placed into /etc/cron.d/ (it's a cron config file)
# We are on a debian-based distribution and use the debian-sys-maint
# account. If you need to create an account for backup purposes, it
# has to have permissions to "read" and "lock tables:
#
@hacklschorsch
hacklschorsch / xslt_google_wetter_3.xslt
Created December 19, 2011 23:29
XSL transform the Google Weather Feed into HTML (sorry, the annotations are in German)
<?xml version="1.0" encoding="UTF-8"?>
<xsl:transform version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.w3.org/TR/xhtml1/strict">
<credit>Florian Sesser für CoSeTrain</credit>
<credit_URL>http://www.cosetrain.com/</credit_URL>
@hacklschorsch
hacklschorsch / tmx_filename_patch_to_zf
Created January 19, 2012 17:27
Patch to Zend Framework 1.11.4 to add filename to exception description when TMX parsing fails
Index: library/Zend/Translate/Adapter/Tmx.php
===================================================================
--- library/Zend/Translate/Adapter/Tmx.php (revision 3015)
+++ library/Zend/Translate/Adapter/Tmx.php (working copy)
@@ -74,9 +74,10 @@
xml_set_character_data_handler($this->_file, "_contentElement");
if (!xml_parse($this->_file, file_get_contents($filename))) {
- $ex = sprintf('XML error: %s at line %d',
+ $ex = sprintf('XML error: %s at line %d of file %s',
@hacklschorsch
hacklschorsch / gist:2788656
Created May 25, 2012 15:08 — forked from founddrama/gist:1013614
a jshint pre-commit hook for git
#!/bin/bash
# A pre-commit hook for git to lint JavaScript files with jshint
# @see https://github.com/jshint/jshint/
#
# @see http://blog.founddrama.net/2011/06/jshint-pre-commit-hook-for-git
# @see https://gist.github.com/1013614
#
# Modified by [email protected] 2012-05-22 for node.js and explicit /bin/bash
if git rev-parse --verify HEAD >/dev/null 2>&1
@hacklschorsch
hacklschorsch / gist:2788752
Created May 25, 2012 15:22
GIT Hook-Chaining script
#!/bin/bash
#
# Author: orefalo
# @see http://stackoverflow.com/questions/8730514/chaining-git-hooks#8734391
#
# Changes:
# [email protected]: Add [0-9] to file glob to exclude .sample files
#
# Usage:
#
@hacklschorsch
hacklschorsch / forever_0.10.0_deps
Created October 12, 2012 10:35
Forever 0.10.0's crazy list of dependencies when installing (ignore 304s, but still. Also looks like npm outputs the GETs to fd 2.)
fs@itagent-mws3%pts/2 (12:27) ~ > npm --no-color install -g forever | grep GET
zsh: correct 'forever' to '.forever' [nyae]? n
npm http GET https://registry.npmjs.org/forever
npm http 304 https://registry.npmjs.org/forever
npm http GET https://registry.npmjs.org/cliff/0.1.8
npm http GET https://registry.npmjs.org/flatiron/0.2.3
npm http GET https://registry.npmjs.org/forever-monitor/1.0.1
npm http GET https://registry.npmjs.org/nconf/0.6.1
npm http GET https://registry.npmjs.org/nssocket/0.3.8
npm http GET https://registry.npmjs.org/optimist/0.3.4
@hacklschorsch
hacklschorsch / gist:4109730
Created November 19, 2012 09:09
Daemontools 'run' file for Meteor/NodeJS
#!/bin/sh
echo Starting Node.js
exec 2>&1
exec envdir ./env node ../../bundle/main.js
@hacklschorsch
hacklschorsch / gist:4109761
Created November 19, 2012 09:12
Add configuration to Daemontools Node.js/Meteor Config Directory
echo "mongodb://localhost/meteor" > service/nodejs/env/MONGO_URL
echo "3000" > service/nodejs/env/PORT
echo "http://meteordeployment.staging.itagenten.de" > service/nodejs/env/ROOT_URL
@hacklschorsch
hacklschorsch / gist:4109767
Created November 19, 2012 09:15
Example "run" file for Multilog
#!/bin/sh
exec multilog t s999999 n20 ./main
@hacklschorsch
hacklschorsch / gist:1a1d81e61465e5414864
Created September 29, 2014 15:00
Textsecure "database disk image is malformed" crash stack trace
E/AndroidRuntime( 2108): FATAL EXCEPTION: main
E/AndroidRuntime( 2108): android.database.sqlite.SQLiteDatabaseCorruptException: database disk image is malformed
E/AndroidRuntime( 2108): at android.database.sqlite.SQLiteQuery.native_fill_window(Native Method)
E/AndroidRuntime( 2108): at android.database.sqlite.SQLiteQuery.fillWindow(SQLiteQuery.java:73)
E/AndroidRuntime( 2108): at android.database.sqlite.SQLiteCursor.fillWindow(SQLiteCursor.java:287)
E/AndroidRuntime( 2108): at android.database.sqlite.SQLiteCursor.getCount(SQLiteCursor.java:268)
E/AndroidRuntime( 2108): at android.widget.CursorAdapter.getCount(CursorAdapter.java:132)
E/AndroidRuntime( 2108): at android.widget.HeaderViewListAdapter.getCount(HeaderViewListAdapter.java:132)
E/AndroidRuntime( 2108): at android.widget.AdapterView$AdapterDataSetObserver.onChanged(AdapterView.java:778)
E/AndroidRuntime( 2108): at android.database.DataSetObservable.notifyChanged(DataSetObservable.java:31)