Skip to content

Instantly share code, notes, and snippets.

Avatar

aeris aeris

View GitHub Profile
@aeris
aeris / Main.java
Created Sep 14, 2011
Java interview question
View Main.java
class Foo1 {
String bar = "bar1";
String getBar() {
return this.bar;
}
void setBar(final String bar) {
this.bar = bar;
}
View rsync-snapshot.pl
#!/usr/bin/perl
END {
kill 15, -$$
}
`renice 10 $$`;
my $rs_conf = "/etc/rsync-snapshot.conf";
@aeris
aeris / dao.py
Created Oct 3, 2011
Possible architecture
View dao.py
# -*- coding: utf-8 -*-
"""
rhodecode.dao
~~~~~~~~~~~~~
Data access layer
:created_on: Oct 4, 2011
:author: nvinot
:copyright: (C) 2011 Nicolas VINOT <aeris@imirhil.fr>
@aeris
aeris / Main.java
Created Nov 4, 2011
Héritage et polymorphisme
View Main.java
public class Main {
private static class A {
protected void foo() {
System.out.println("A");
}
}
private static class B extends A {
@Override
protected void foo() {
@aeris
aeris / zshprompt
Created Jul 7, 2012
Git prompt for ZSH
View zshprompt
autoload -U colors
colors
# Allow for functions in the prompt.
setopt prompt_subst
autoload -U add-zsh-hook
add-zsh-hook chpwd chpwd_update_git_vars
add-zsh-hook preexec preexec_update_git_vars
@aeris
aeris / zshprompt.sh
Last active Oct 7, 2015
ZSH SCM prompt
View zshprompt.sh
autoload -U colors
colors
# Allow for functions in the prompt.
setopt prompt_subst
autoload -U add-zsh-hook
add-zsh-hook chpwd update_scm_vars
add-zsh-hook preexec preexec_update_scm_vars
@aeris
aeris / addNetworkManagerConnection.py
Created Aug 1, 2012
Create Network Manager connection from command line
View addNetworkManagerConnection.py
import dbus, struct, socket, uuid
def _ip(ip):
t = socket.inet_aton(ip)
return dbus.UInt32(struct.unpack("I", t)[0])
def _ips(ips):
return dbus.Array([_ip(ip) for ip in ips], signature=dbus.Signature('u'))
def _ip6(ip):
@aeris
aeris / bak.sh
Created Aug 8, 2012
Backup utility
View bak.sh
#!/bin/bash
backup() {
mv "${1}" "${1}.bak"
}
restore() {
mv "${1}" "${1/%\.bak/}"
}
@aeris
aeris / ir_black.colorsheme
Created Aug 9, 2012
IR Black for Konsole
View ir_black.colorsheme
[Background]
Color=0,0,0
Transparency=false
[BackgroundIntense]
Bold=true
Color=44,44,44
Transparency=false
[Color0]
@aeris
aeris / mvn-activate.sh
Created Sep 2, 2012
Maven settings activator
View mvn-activate.sh
#!/bin/bash
PROFILE=$1
MVN_HOME=~/.m2
SETTINGS_FILE=settings.xml
SETTINGS="${MVN_HOME}/${SETTINGS_FILE}"
if [ -z "$1" ]; then
rm -f "${SETTINGS}"
else