Skip to content

Instantly share code, notes, and snippets.

View aeris's full-sized avatar

aeris aeris

View GitHub Profile
@aeris
aeris / main.qml
Created October 28, 2012 11:15
Widget problem size
import Qt 4.7
import org.kde.plasma.core 0.1 as PlasmaCore
import org.kde.plasma.graphicswidgets 0.1 as PlasmaWidgets
Item {
id: pomodoro
PlasmaWidgets.PushButton {
id: button
anchors {
@aeris
aeris / cryptroot-prepare.sh
Last active October 13, 2015 19:38
Cryptfs multiple device with one passphrase
#!/bin/sh
# Auto-LUKS : Automatically open multiple LUKS containers with a single passphrase
# Aeris <aeris@imirhil.fr>
# Licensed under AGPLv3 or later
PREREQ=""
prereqs() {
echo "$PREREQ"
}
public String foreignKeyColumnName(final String propertyName,
final String propertyEntityName, final String propertyTableName,
final String referencedColumnName) {
return this.columnName(propertyTableName) + "_"
+ this.columnName(referencedColumnName);
}
@aeris
aeris / google-authenticator.rb
Created November 24, 2015 22:48
Google Authenticator CLI
#!/usr/bin/env ruby
# Licence : AGPLv3+
require 'cgi'
require 'fileutils'
require 'optparse'
require 'rotp'
require 'tempfile'
require 'uri'
class GoogleAuthenticator
@aeris
aeris / DateTimeRange.java
Created December 18, 2012 09:35
Java refactoring
public class DateTimeRange {
private final DateTime start;
private final DateTime end;
public DateTimeRange(final DateTime start, final DateTime end) {
this.start = start;
this.end = end;
}
public DateTime getStart() {
@aeris
aeris / xd.rb
Created December 31, 2012 14:24
Fast cd with learning
#!/usr/bin/env ruby
#encoding: utf-8
require 'sqlite3'
SEPARATOR = ''
class Stats
DB_FILE=File.join Dir.home, ".xd.sqlite3"
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface DbSchema {
String value();
}
@aeris
aeris / firewall.sh
Created March 10, 2013 13:17
rc.d firewall for iptables with IPv6
### BEGIN INIT INFO
# Provides: firewall
# Required-Start: $local_fs $network
# Required-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
### END INIT INFO
#!/bin/sh
@aeris
aeris / pools.rb
Last active December 17, 2015 00:00
Bitcoin mining pools monitoring
#!/usr/bin/env ruby
$: << '/usr/lib/ruby/1.9.1/x86_64-linux'
require 'RRD'
require 'json'
require 'httparty'
COLORS = {
:dark => {
:red => '#CC3118',
:orange => '#CC7016',
@aeris
aeris / NpeWithoutMethodCall.java
Created May 22, 2013 11:08
Java silly code…
public class NpeWithoutMethodCall {
public static void main(String[] args) {
Integer defaultValue = null;
Integer value = true ? defaultValue : 0;
}
}
// javac NpeWithoutMethodCall.java && NpeWithoutMethodCall Foo
// Exception in thread "main" java.lang.NullPointerException
// at NpeWithoutMethodCall.main(NpeWithoutMethodCall.java:4)