Skip to content

Instantly share code, notes, and snippets.

View ChristianGaertner's full-sized avatar

Christian Gärtner ChristianGaertner

View GitHub Profile
@ChristianGaertner
ChristianGaertner / hidden_iframe.css
Created July 5, 2013 15:30
This will hide all iframes on a page with the id `analytics_iframe`
#analytics_iframe {
visibility: hidden;
position: absolute;
top: -9999px;
left: -9999px;
}
@ChristianGaertner
ChristianGaertner / link-converter.php
Created July 26, 2013 13:05
Convert Links into HTML anchors with ease.
@ChristianGaertner
ChristianGaertner / generatImage.js
Created August 14, 2013 20:17
[IDEA] PhantomJS Dynamic HTML render-engine
var page = require(‘webpage’).create();
page.viewportSize ={ width: 200, height : 200 };
page.content = “GoogleChart goes here”; //maybe load a skeleton here and replace some data.
page.setContent(page.content,page);
window.setTimeout(function () {
page.render(‘newimage.png’);
phantom.exit();
}, 1000);
@ChristianGaertner
ChristianGaertner / replace.sh
Created August 17, 2013 09:44
Replace String in all files of the current directory
grep -rl 'OLDSTRING' ./ | xargs sed -i 's/OLDSTRING/NEWSTRING/g'
@ChristianGaertner
ChristianGaertner / git-squash.sh
Created September 3, 2013 20:57
An alternative to the interactive git rebase. (I like this method better.)
# Reset the current branch to the commit just before the last X:
# X is here the number of commits to squash together
git reset --hard HEAD~X
# HEAD@{1} is where the branch was just before the previous command.
# This command sets the state of the index to be as it would just
# after a merge from that commit:
git merge --squash HEAD@{1}
# Commit those squashed changes. The commit message will be helpfully
@ChristianGaertner
ChristianGaertner / Reversed.java
Last active December 23, 2015 00:39
Reverse Iterator for ArrayLists and the like. Use it in your foreach loops
public class Reversed<T> implements Iterable<T> {
private final List<T> org;
public Reversed(List<T> original) {
org = original;
}
public Iterator<T> iterator() {
final ListIterator<T> i = org.listIterator(org.size());
@ChristianGaertner
ChristianGaertner / fix_cursor.sh
Created April 17, 2014 18:15
Fixes the cursor flickering under Ubuntu Unity (in chroot made with crouton)
sudo cp /usr/share/icons/DMZ-White/cursors/arrow /usr/share/icons/DMZ-White/cursors/watch
#!/usr/bin/env python2
"""
Author: takeshix <takeshix@adversec.com>
PoC code for CVE-2014-0160. Original PoC by Jared Stafford (jspenguin@jspenguin.org).
Supportes all versions of TLS and has STARTTLS support for SMTP,POP3,IMAP,FTP and XMPP.
"""
import sys,struct,socket
from argparse import ArgumentParser
#!/bin/bash
# PHP 5
export PATH=/usr/local/php5/bin:$PATH #PHP 5.5
alias mysql="/usr/local/mysql/bin/mysql"
#JAVA_HOME
export JAVA_HOME=$(/usr/libexec/java_home)
@ChristianGaertner
ChristianGaertner / pr.md
Created July 27, 2015 19:16
achtern pull request template

One line to describe the pull request

Q A
Bug fix? yes/no
New feature? yes/no
BC breaks? yes/no
if BC breaks; where? %
Deprecations? yes/no
Tests pass? yes/no