This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class LinkedSet<Row> { | |
/* "Empty" list, is first and last with null values - first & last are same */ | |
private Node first = null; | |
private Node last = null; | |
private Map<Row, Node> index = new HashMap<Row, Node>(); | |
/* Linked-list node */ | |
private final class Node { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Remedian algorithm rework to use matrices rather than discrete arrays | |
"""The program of Figure 2 can be easily adapted to produce | |
the remedian curve, by replacing the arrays A l , A2, | |
A3, and A4 of length 11 by matrices with 11 rows and T | |
columns. In this way the total storage becomes 44T, whereas | |
the plain median would have needed 14,641T positions""" | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ nohup bash -c "(. env.sh ; make all > /tmp/build.log.${!} 2>&1 ; mv /tmp/build.log.${!} .)" & |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Tips from https://www.mattcutts.com/blog/a-quick-tutorial-on-screen/ | |
# Use Ctrl-Z instead of Ctrl-A for escape | |
#escape ^Zz | |
# "You'll get scrolling like you're used to (with your wheely mouse)" | |
termcapinfo xterm|xterms|xs|rxvt ti@:te@ | |
# you will get a bottom bar indicating name of machine you're on, a clock, and indicators in which shell you currently are. | |
# Use CTRL-A SHIFT-A to rename your shells. The names will then also appear in the bottom bar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/bash | |
# | |
VM_NAME=$1 | |
SSH_PORT=$(VBoxManage showvminfo ${VM_NAME} --machinereadable | awk -F, '/^Forwarding\([0-9]+\)="/ && $NF == "22\"" { print $(NF-2) ; exit}') | |
echo "SSH PORT: $SSH_PORT" | |
VBoxManage.exe list runningvms | grep -q "^\"$VM_NAME\" " || ( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from hashlib import md5 | |
from binascii import unhexlify, hexlify | |
seq_xor = lambda c, b: ''.join( | |
chr(x) for x in map(lambda X: ord(X[0]) ^ ord(X[1]), zip(c, b)) | |
) | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface Resource { | |
void monopolise() throws InterruptedException; | |
} | |
public class Interrupts implements Runnable { | |
private final MyResources myRes; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# rrusk 2015-11-25 Universal bash profile | |
# 2015-12-21 Added Colour Output for Ant | |
# 2016-01-25 ignore CVS and .svn autocomplete | |
# notify version | |
echo hello 8.2 | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# set base of 'my' epoch (here it's the start of the 21st century) | |
export MY_EPOCH=$(expr $(date --date="2000/01/01 00:00:00" +%s)) | |
# format date and time, as expressed in minutes from start of 'my' epoch | |
function strftime_my { | |
date --date="@$(expr $MY_EPOCH + \( $1 \* 60 \) )" | |
} | |
# format date, as expressed in days from start of 'my' epoch | |
function strfdate_my { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rem lines starting with "rem" are commented out similar to '#' in unix-land | |
rem so you want to have a useful windows command-line? | |
rem put this file in some standard location like "C:\myscripts" | |
rem then right-click, "New > Shortcut" and enter the following for location: | |
rem C:\Windows\System32\cmd.exe /K "C:\myscripts\mycmd.cmd" | |
rem give it a name you like and then 'finish' | |
rem then right-click on the shortcut, go to "Properties" and set "Start in:" to be your "Home Directory" | |
rem I've tried to explain some of the peculiarities of windows "batch-file" and "doskey" scripting below ... |
NewerOlder