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.
C=32
for i in {0..282};
do
for j in $(seq 0 $(($C-1)));
do
k=$((i*$C+j+1000))
if (( $k % 500 == 0 )) # show progress
then
echo $k
fi
echo $banditpass $k | nc localhost 30002 | grep -v Wrong | grep -v Exiting | grep -v checker &
done
while [ `jobs -r | wc -l | tr -d " "` >= $C ]; do
sleep 1
done
done |
Working within the allowed number of parallel background jobs.
Tuesday, August 1st, 2017
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
i=2;
while i<max:
ii = math.floor(math.sqrt( i ))
found = False
j=0
while j<len(pSieve):
if ( pSieve[j] > ii ):
break;
if (i % pSieve[j] == 0):
found = True
break;
j+=1
if found == False:
pSieve.append(i)
if (600851475143 % i == 0):
l=i
i+=1
print l |
Wednesday, March 16th, 2016
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.
Tuesday, March 15th, 2016
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.
Just in case some poor sap like me gets stuck with errors
connecting to Build Forge Agents:
320 AUTH AuthFail[*AuthUnknownUser,"username"]
com.buildforge.services.common.api.APIException:
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
Wednesday, November 18th, 2015
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<orig.length;i++)
chars[i] = orig[i].charAt(0);
Arrays.sort(chars);
}
public boolean checkWord(char[] find){
if(find.length > chars.length) return false;
Arrays.sort(find);
int s=0;
for(int i=0;i<find.length;i++){
for(int j=s;j<chars.length;j++){
if(find[i] > chars[j]) continue;
if(find[i] == chars[j]){
s=j+1;
break;
}
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();
r.load(args[1]);
System.out.println(args[1]);
String line;
while((line = br.readLine()) != null) {
System.out.print(line+" ");
System.out.println(r.set.checkWord(line.toCharArray()));
}
br.close();
}
} |
There’s probably a better way to do this, I am interested
to see what other solutions there are.
Short two liner for ANT zipping on Windows.
>build.xml echo ^<project^>^<zip destfile=^"zipFile.zip^" basedir=^"toBeZipped^" /^>^</project^>
ant |
Because Windows doesn’t apparently have a zip command line.
Updated here for Windows without ANT.
Thursday, April 3rd, 2014
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 >
Wednesday, September 4th, 2013
“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.
Cheers.
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…