Skip to content

Instantly share code, notes, and snippets.

@hydra1983
hydra1983 / progress-generator
Created August 7, 2013 06:53
An algorithm to generate progress info for tasks. Run with nodejs.
var num = 0;
var num2 = 0.0;
var num3 = 0.0;
var num4 = 0.0;
var num5 = 0.0;
console.log("part1");
var part1 = [{
batchCount : 5
},{
@hydra1983
hydra1983 / ant-contrib_for_i
Last active December 18, 2015 17:49
Counter for iteration a list in for task based on math task of ant-contrib
<var name="counter" value="0"/>
<for list="{list}" param="{param}">
<sequential>
<switch value="${counter}">
<case value="0">
<!-- do something -->
</case>
<case value="1">
<!-- do something -->
@hydra1983
hydra1983 / vpn init script
Created January 7, 2013 10:47
init script to connect or disconnect vpn client
#!/bin/sh
### BEGIN INIT INFO
# Provides: vpn
# Required-Start: $syslog $local_fs $remote_fs $network $named
# Required-Stop: $syslog $local_fs $remote_fs $network $named
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start the vpn.
### END INIT INFO
@hydra1983
hydra1983 / geminabox
Created November 15, 2012 08:27
geminabox startup scripts
#!/bin/bash
### BEGIN INIT INFO
# Provides: geminabox
# Required-Start: $local_fs $remote_fs $network
# Required-Stop: $local_fs $remote_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start Geminabox.
# Description: Start the Geminabox service.
@hydra1983
hydra1983 / ssh-tunnel
Last active May 2, 2018 09:26
script to start a ssh tunnel using autossh on ubuntu
#! /bin/sh
#
# Author: Edison <[email protected]>
#
# This is a modified version for from Andreas Olsson <[email protected]>
# For each tunnel; make a uniquely named copy of this template.
## SETTINGS
#
# autossh monitoring port (unique)