Skip to content

Instantly share code, notes, and snippets.

@agazso
agazso / gitup
Created November 10, 2010 10:48
Shell script for synchronizing local git repository with remote
#!/bin/sh
PUSH=1
BRANCH=$(git status | head -1 | sed -n 's/^# On branch //p')
STATUS_TAIL=$(git status | tail -1)
if [ "$STATUS_TAIL" = "nothing added to commit but untracked files present (use \"git add\" to track)" ]; then
PUSH=0
fi
if [ "$PUSH" = "1" ]; then
@agazso
agazso / pinger.html
Created March 3, 2011 00:15
pinger.html
<html>
<script type="text/javascript">
function update(name, status, timeout)
{
var id = "ping:" + name.replace('/', ':');
var div = document.getElementById(id);
div.innerHTML = name + " is " + status;
var background = "white";
var color = "black";
@agazso
agazso / runm.cmd
Created July 20, 2011 19:48
Run the same command multiple times in parallel on Windows
REM Runm: Run the same command multiple times in parallel on Windows
REM First argument is the number of processes to be run in parallel
REM Second argument is the name of the process to be run
REM Change /K to /C if you want to close the windows after the processes are done running
FOR /L %%I IN (1,1,%1) DO START CMD /K %2
@agazso
agazso / runm
Created July 21, 2011 15:22
Run the same command multiple times in parallel
#!/bin/bash
COUNT=$1
shift
for ((i=0; i<$COUNT; i++))
do
$* &
done
@agazso
agazso / acceptsship.sh
Created August 1, 2011 23:36
Accept IP-address on SSH port for a timeout interval
#!/bin/sh
DEFAULT_TIMEOUT=60
ACCEPTSCRIPT=$0
if [ "$1" = "" ]; then
echo
echo "Usage:"
echo " acceptsship.sh <ip-address> [timeout=${DEFAULT_TIMEOUT}s]"
echo
@agazso
agazso / gist:1208227
Created September 10, 2011 11:55
Helper function for creating lexicographically ordered ids
/// <summary>
/// Helper function for creating lexicographically ordered ids
/// </summary>
public static string Id(Int64 num)
{
return String.Format("{0:0000000000000}", num);
}
@agazso
agazso / Git commit hook script
Created November 30, 2011 11:03
git-check-scaliendb.sh
#!/bin/bash
BRANCH=dev
TARGETS="debug release cli javalib"
if [ "$1" != "" ]; then
BRANCH=$1
fi
function cleanup {
@agazso
agazso / wgetdiag.cmd
Created July 18, 2012 11:52
WGet a page every minute and save it
SET URL=http://localhost:8080
:START
SET CDATE=%DATE%
:: Remove trailing dot
SET CDATE=%CDATE:~,-1%
:: Replace colons with dots
SET CTIME=%TIME::=.%
:: Remove spaces
SET CTIME=%CTIME: =0%
@agazso
agazso / screensaverdisable.reg
Created July 18, 2012 11:53
Disable screen saver registry script
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Control Panel\Desktop]
"ScreenSaverIsSecure"="0"
"ScreenSaveActive"="0"
"ScreenSaveTimeOut"="999999999"
@agazso
agazso / .pythonstartup
Created November 28, 2012 14:56
.pythonstartup
import rlcompleter
import readline
readline.parse_and_bind ("bind ^I rl_complete")