Skip to content

Instantly share code, notes, and snippets.

Florian Sesser hacklschorsch

Block or report user

Report or block hacklschorsch

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@hacklschorsch
hacklschorsch / FileChangeNotifier.java
Last active Jul 15, 2019
Java observable that notifies on changes to a File using Java 7 NIO and a separate thread.
View FileChangeNotifier.java
import java.io.Closeable;
import java.io.File;
import java.io.IOException;
import java.nio.file.*;
import java.util.Observable;
import static java.nio.file.StandardWatchEventKinds.*;
/**
* FileChangeNotifier notifies its observers when @file has changed.
* It uses Java 7 NIO and runs in a separate thread (since the NIO call blocks).
@hacklschorsch
hacklschorsch / gist:1a1d81e61465e5414864
Created Sep 29, 2014
Textsecure "database disk image is malformed" crash stack trace
View gist:1a1d81e61465e5414864
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)
@hacklschorsch
hacklschorsch / gist:4109767
Created Nov 19, 2012
Example "run" file for Multilog
View gist:4109767
#!/bin/sh
exec multilog t s999999 n20 ./main
@hacklschorsch
hacklschorsch / gist:4109761
Created Nov 19, 2012
Add configuration to Daemontools Node.js/Meteor Config Directory
View gist:4109761
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:4109730
Created Nov 19, 2012
Daemontools 'run' file for Meteor/NodeJS
View gist:4109730
#!/bin/sh
echo Starting Node.js
exec 2>&1
exec envdir ./env node ../../bundle/main.js
@hacklschorsch
hacklschorsch / forever_0.10.0_deps
Created Oct 12, 2012
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.)
View forever_0.10.0_deps
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:2788752
Created May 25, 2012
GIT Hook-Chaining script
View gist:2788752
#!/bin/bash
#
# Author: orefalo
# @see http://stackoverflow.com/questions/8730514/chaining-git-hooks#8734391
#
# Changes:
# fs@it-agenten.com: Add [0-9] to file glob to exclude .sample files
#
# Usage:
#
@hacklschorsch
hacklschorsch / gist:2788656
Created May 25, 2012 — forked from founddrama/gist:1013614
a jshint pre-commit hook for git
View gist:2788656
#!/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 fs@it-agenten.com 2012-05-22 for node.js and explicit /bin/bash
if git rev-parse --verify HEAD >/dev/null 2>&1
@hacklschorsch
hacklschorsch / tmx_filename_patch_to_zf
Created Jan 19, 2012
Patch to Zend Framework 1.11.4 to add filename to exception description when TMX parsing fails
View tmx_filename_patch_to_zf
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 / xslt_google_wetter_3.xslt
Created Dec 19, 2011
XSL transform the Google Weather Feed into HTML (sorry, the annotations are in German)
View xslt_google_wetter_3.xslt
<?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>
You can’t perform that action at this time.