Overthewire Bandit 24

A daemon is listening on port 30002 and will give you the password for bandit25 if given the password for bandit24 and a secret numeric 4-digit pincode. There is no way to retrieve the pincode except by going through all of the 10000 combinations, called brute-forcing.

for i in {0..282};
    for j in $(seq 0 $(($C-1)));
    if (( $k % 500 == 0 )) # show progress
      echo $k

    echo $banditpass $k | nc localhost 30002 | grep -v Wrong | grep -v Exiting | grep -v checker &

  while [ `jobs -r | wc -l | tr -d " "` >= $C ]; do
    sleep 1

Working within the allowed number of parallel background jobs.

Project Euler – Problem 3

Problem 3:
The prime factors of 13195 are 5, 7, 13 and 29.

What is the largest prime factor of the number 600851475143 ?

import math

pSieve = []
max = math.floor(math.sqrt( 600851475143 ))
l = 0
while i ii ):
		if (i % pSieve[j] == 0): 
			found = True
	if found == False:
		if (600851475143 % i == 0):
print l

Update to quick one-liner Windows unzips

So this one is taken from https://blogs.msdn.microsoft.com/daiken/2007/02/12/compress-files-with-windows-powershell-then-package-a-windows-vista-sidebar-gadget/

echo $zipfilename=$args[0]; $destination=$args[1];if(test-path($zipfilename)) {$shellApplication = new-object -com shell.application;$zipPackage = $shellApplication.NameSpace($zipfilename);$destinationFolder = $shellApplication.NameSpace($destination); $destinationFolder.CopyHere($zipPackage.Items()); };>unzip.ps1

powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -File unzip.ps1 %FullPathToZip% %FullPathToTarget%

This was tested on PSv2.

Buildforge CRRBF1253I Process for id [] [B] died unexpectedly.

I kept getting Completed — Failed — Died and
CRRBF1253I Build Forge: Process for id [] [B] died unexpectedly.

After checking out http://www.ibm.com/support/docview.wss?uid=swg21634022 and
http://www.ibm.com/support/docview.wss?uid=swg21634022 there was still no solution in sight.

Finally I was able to solve the issue in my buildforge instance by disabling *sticky* in my inline libraries. I was also using .bset server and .bset buildserver. My theory is that some interaction between the sticky and the bset were conflicting.

Build Forge Agent Troubleshooting

Just in case some poor sap like me gets stuck with errors
connecting to Build Forge Agents:

320 AUTH AuthFail[*AuthUnknownUser,"username"]
CRRBF0158I: Unable to set user account to unknown account (builder)
at com.ibm.jas.mjc.server.refresh.AgentServerTestFiber.checkAuth(AgentServerTestFiber.java:431)

Some fixes..

sudo cp /etc/pam.d/login /etc/pam.d/bfagent
sudo /usr/local/bin/bfagent -s

Scrabble Problem

If I give you scrabble tiles and a dictionary, determine the valid words
from your collection of tiles.

package joshho;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.Arrays;

public class Runner {
	ScrabbleSet set ;
	private class ScrabbleSet {
		char[] chars;
		public ScrabbleSet(String[] orig){
			chars = new char[orig.length];
			for(int i=0;i chars.length) return false;
			int s=0;
			for(int i=0;i chars[j]) continue;
					if(find[i] == chars[j]){
					return false;
			return true;
	public void load(String y){
		set = new ScrabbleSet(y.split(" "));

	public static void main(String[] args) throws IOException {
		args = new String[]{"Scrabble\\data\\english4000.dic",
				"g w x b d u t z q m o i e p o"};
		FileReader fr =  new FileReader(args[0]);
		BufferedReader br = new BufferedReader(fr);

		Runner r = new Runner();
		String line;
		while((line = br.readLine()) != null) {
			System.out.print(line+" ");


There’s probably a better way to do this, I am interested
to see what other solutions there are.

Zip with ANT on Windows command line

Short two liner for ANT zipping on Windows.


>build.xml echo ^<project^>^<zip destfile=^"zipFile.zip^" basedir=^"toBeZipped^" /^>^</project^>

Because Windows doesn’t apparently have a zip command line.

Updated here for Windows without ANT.

Working with genrb and ICU4J

Wanting to use the messages in ICU4J, I was lead to believe one needed to run the command:

genrb root.txt

This produces root.res.
However using the following snippet results in the error message below:

UResourceBundle urb = UResourceBundle.getBundleInstance("Your package path","root");

>Data file yourPackagePath/root.res is corrupt - ICU data file error: Header authentication failed, please check if you have a valid ICU data file

Continued reading >

Cookie cannot be resolved to a type

“Cookie cannot be resolved to a type”

I swear I’ve seen this error like 5 times in eclipse now, and I have yet to learn my lesson.
If this error originates from a jsp file, your project doesn’t have a valid target webserver (in my case – tomcat).

So just make sure it’s configured correctly.

Thought I’d just leave this here,
because almost all top searches in google were useless to me.


Bash Pitfalls

I was on IRC.. and noticed this link.. http://mywiki.wooledge.org/BashPitfalls,
if I had only known earlier…

Tons of useful information on Bash Pitfalls… as well as tons of habits to change… :/

My error was specifically #22,
cmd1 && cmd2 || cmd3 where I had assumed cmd2 is going to exit 0.

In most of my usecases… my command is in the form of cmd1 || sleep # && cmd3, I just naturally assume sleep is going to return 0.

Well, luckily for me, it has worked for the most part… but definitely need to change a number of my scripting habits…