Skip to content

Instantly share code, notes, and snippets.

@agazso
agazso / gist:4161785
Created November 28, 2012 14:57
PDB
import pdb; pdb.set_trace() # NOCOMMIT
@agazso
agazso / .zshrc
Created November 30, 2012 22:26
.zshrc
# Thing to set in interactive sessions of zsh
autoload -Uz vcs_info
# Execute before prompt
precmd()
{
vcs_info || return
}
@agazso
agazso / javar.sh
Created December 1, 2012 15:30
Java Runner
#!/bin/sh
if [ "$1" = "" ]; then
echo "Usage: javar class [args...]"
exit 1
fi
javac $1.java && java $1
@agazso
agazso / run.sh
Created March 3, 2013 21:01
Run commands protected by lock
#!/bin/sh
LOCKFILE=/tmp/meeting_dashboard.lock
COMMAND="$*"
[ "$1" = "" ] && (echo usage $0 command; exit 1)
# Previous run should execute successfully:
[ -f $LOCKFILE ] && exit 0
@agazso
agazso / gist:5780745
Last active December 18, 2015 12:09
Conflict resolution with global command ordering and rebasing
# Conflict resolution with global command ordering and rebasing
class Obj:
def __init__(self, id):
self.matrix = (0, 0, 0, 0)
self.id = id
def __repr__(self):
return "%s" % repr(self.id)
@agazso
agazso / gitsync
Last active April 25, 2018 11:40
#!/bin/sh
COLOR="\033[0;32m"
RESET_COLOR="\033[0m"
output() {
echo "$COLOR$1$RESET_COLOR"
}
PUSH=1
@agazso
agazso / gitsup
Created September 12, 2013 16:26
Git update repository with stashing local changes
#!/bin/sh
set -e
status=$(git status -s -uno)
[ "$status" != "" ] && git stash
git pull --rebase
@agazso
agazso / laserpointer.html
Last active December 24, 2015 00:29
Laserpointer with canvas
<html>
<head>
<script>
var canvas;
var points = [];
var timer;
var mousePos;
var prevPos;
function start() {
@agazso
agazso / laserpointer.js
Last active December 24, 2015 10:29
laserpointer.js
var LaserPointer = (function () {
var module = {};
var canvas;
var points = [];
var timer;
var mousePos;
var prevPos;
var maxLength = 15;
var maxWidth = 5;
@agazso
agazso / replaceString.elm
Last active August 29, 2015 13:56
replaceString
replaceString : String -> String -> String -> String
replaceString input from to = String.join to (String.split from input)
replaceString2 input from to = String.join to <| String.split from input
replaceString3 input from to = String.split from input |> String.join to
replaceString4 input from to = (String.join to . String.split from) input