How can i generate a wordlist with crunch starting and ending like this? : - passwords

How can i generate a wordlist with crunch starting and ending like this?:
AAA#AAA
AAB#AAB
AAC#AAC
.
.
.
.
ZZZ#ZZZ

Related

Allow one random character at any position in string pattern

I want to find a specific pattern in a string with the allowance of one (or a number I can set) tolerance deviation character at any position in the string.
So if I am looking for a date in the Format yyyy-mm-dd. Then I would like to accept for example:
'2020-08x-12'
'x2020-08-01'
'2020-08-x12'
So far I've got the Standard pattern recognition:
SELECT foo
FROM bar
WHERE foo LIKE '[1-2][0-9][0-9][0-9][-][0-1][0-9][-][0-3][0-9]'
Now I would like to allow a random character in between (max 1 character) and still recognize the pattern.
SQL Server is not optimal for this but you can use a massive OR and LIKE:
WHERE foo LIKE '[1-2][0-9][0-9][0-9][-][0-1][0-9][-][0-3][0-9]' OR
foo LIKE '[1-2][0-9][0-9][0-9][-][0-1][0-9][-][0-3][0-9]_' OR
foo LIKE '[1-2][0-9][0-9][0-9][-][0-1][0-9][-][0-3]_[0-9]' OR
foo LIKE '[1-2][0-9][0-9][0-9][-][0-1][0-9][-]_[0-3][0-9]' OR
. . .
foo LIKE '_[1-2][0-9][0-9][0-9][-][0-1][0-9][-][0-3][0-9]'
The _ matches exactly one character. So the idea is to put it in the pattern at every possible position.
Hmmm . . . an alternative method that should work is to match with any "random" characters between the known ones and then check the length:
WHERE foo LIKE '%[1-2]%[0-9]%[0-9]%[0-9]%[-]%[0-1]%[0-9]%[-]%[0-3]%[0-9]%' AND
LEN(foo) IN (10, 11)

Removing whitespace only after closing tag in HAML

I have a list of items separated by commas. It looks like this:
With a user-centric, iterative, and pragmatic approach
"User-centric" is wrapped in a span.highlight.
%span.highlight>user-centric removes the whitespace between the content and the comma as expected but it also removes the whitespace between 'a' and 'user-centric.'
With auser-centric, iterative . . .
What's the cleanest way to get rid of the trailing whitespace?

Antlr Lexer exclude a certain pattern

In Antlr Lexer, How can I achieve parsing a token like this:
A word that contains any non-space letter but not '.{' inside it. Best I can come up with is using a semantics predicate.
WORD: WL+ {!getText().contains(".{")};
WL: ~[ \n\r\t];
I'm a bit worried to use semantics predicate though cause WORD here will be lexed millions of times I would think to put a semantics predicate will hit the performance.
This is coming from the requirement that I need to parse something like:
TOKEN_ONE.{TOKEN_TWO}
while TOKEN_ONE can include . and { in its letter.
I'm using Antlr 4.
You need to limit your predicate evaluation to the case immediately following a . in the input.
WORD
: ( ~[. \t\r\n]
| '.' {_input.LA(1)!='{'}?
)+
;
How about rephrasing your question to the equivalent "A word contains any character except whitespace or dot or left brace-bracket."
Then the lexer rule is just:
WORD: ~[ \n\r\t.{]*

Why use 'succeed do' in haml?

I used html2haml.heroku.com and it turned some ordinary strings into the following:
A normal sentence is here
= succeed '.' do
%strong and it is cut off randomly by this succeed
Where the succeed call seems unnecessary. Is this just an artifact from the html to haml conversion?
If you try
A normal sentence is here
= succeed '.' do
%strong and it is cut off randomly by this succeed
and generate the HTML, the output will be like this:
A normal sentence is here
<strong>and it is cut off randomly by this succeed</strong>.
However, if you try something like
A normal sentence is here
%strong and it is cut off randomly by this succeed
.
You will have an output like this:
A normal sentence is here
<strong>and it is cut off randomly by this succeed</strong>
.
And white spaces are important in inline elements - please refer to my (late) answer in this question

Pig : parsing line with blank delimiter

I'm using Hadoop Pig (0.10.0) to process logs file, a log line looking like :
2012-08-01 INFO (User:irim) getListedStocksByMarkets completed in 7041 ms
I would like to get a relation with tokens split by blanks, that is :
(2012-08-01,INFO,(User:irim),getListedStocksByMarkets,completed,in,7041,ms)
Loading that data with statement :
records = LOAD 'myapp.log' using PigStorage(' ');
did not achieve that because my tokens can be separated by several white space leading to several empty tokens.
PigStorage does not seem to support regexp delimiter (or at least I haven't succeeded configuring it that way).
So my question : what would be the best way to get those tokens ?
If I could remove empty elements from a relation I would be happy, is possible to do that with Pig ?
For example starting from :
(2012-08-01,,,INFO,,,(User:irim),,getListedStocksByMarkets,completed,in,7041,ms)
To get
(2012-08-01,INFO,(User:irim),getListedStocksByMarkets,completed,in,7041,ms)
I'm trying another approach with TextLoader then TOKENIZE but I'm not sure it's the best strategy.
Maybe a User Load Function is a more natural choice ...
Regards,
Joel
You can use built in function STRSPLIT with regular expression to break a line into a tuple. Here is a script for your particular example with comma as a separator:
inpt = load '~/data/regex.txt' as (line : chararray);
dump inpt;
-- 2012-08-01,,,INFO,,,(User:irim),,getListedStocksByMarkets,completed,in,7041,ms
splt = foreach inpt generate flatten(STRSPLIT(line, ',+'));
dump splt;
-- (2012-08-01,INFO,(User:irim),getListedStocksByMarkets,completed,in,7041,ms)