Use word count to make sure you’re getting the length you expected.
cat /dev/urandom| tr -dc 'a-zA-Z0-9-_!@#$%^&*()_+{}|:<>?=' | fold -w 1048 | head -n1 | wc -m
And use this to actually fetch the long string.
cat /dev/urandom| tr -dc 'a-zA-Z0-9-_!@#$%^&*()_+{}|:<>?=' | fold -w 1048 | head -n1 | wc -m
Here’s a much simpler example, in case you just want a quick four digit number:
cat /dev/urandom| tr -dc ’0-9′ | fold -w 4 | head -n1
Since my last several modules have been core enough to merit creating both Java and .Net, I’m getting pretty proficient at translating between the two languages.
Here’s my Java version of my previous article about C# Debug Output.
private static final boolean DEBUG = true;
private static void DebugOutput(String message)
{
DebugOutput(message, null);
}
private static void DebugOutput(String message, Object details)
{
if(DEBUG)
{
System.out.println(message + ": " + details.toString());
}
}
Got tired of searching up this line elsewhere. Now that I’m writing this, I’ll probably memorize it in the process. That’ll be nice.
public override String ToString()
{
return "' Search scope: " + this.searchScope
+ " Filter: '" + this.getFilter()
+ "' Search base: '" + this.searchBase + "'"
+ " Returned attributes: {" + String.Join(" , ", this.returnedAttributes.ToArray()) + "}";
}