Skip to content

Instantly share code, notes, and snippets.

View alexec's full-sized avatar
😀

Alex Collins alexec

😀
View GitHub Profile
#! /bin/sh
set -eux
cd docker-java
git pull
mvn clean deploy
git push
rm -R ~/.m2/repository/com/alexecollins/docker-java
cd ..
@alexec
alexec / reveal-passwords.js
Last active December 29, 2015 04:39
Reveal Passwords
var is=document.getElementsByTagName('input');for (var i=0;i<is.length;i++){var x=is[i];if (x.type=='password') {x.type='text'}}
@alexec
alexec / stopwatch.sh
Created September 4, 2013 18:04
Run a command with as stopwatch, print the seconds as they pass. So you can track the progress of a command that lacks it's own progress bar.
#!/bin/bash
set -ue
BEGIN=$(date +%s)
BACK="\b\b\b\b"
($* ; touch /tmp/$$.done) &
OLDDIFF=0
while true; do
@alexec
alexec / history.rb
Created August 3, 2013 10:33
A class to keep a short, persistent history of some values.
require 'csv'
class History
def initialize(name, cols, size)
@f=name
@headers=cols
@size=size
read
write
end
@alexec
alexec / csv_example.rb
Created August 3, 2013 10:21
Example of reading and writing a CSV file
# suitable for small files only
require 'csv'
f='a.csv'
headers=['x','y']
csv=[]
if File.exists?(f)
CSV.foreach(f, {:headers => :first_row, :converters => [:numeric]}) do |row|
import java.io.IOException;
import java.io.InputStream;
/**
* @author alex.collins
*/
public class SearchAndReplaceInputStream extends InputStream {
private final InputStream is;