Skip to content

Instantly share code, notes, and snippets.

@alexxv
alexxv / profile_python
Created October 7, 2020 15:01
Profile python script
# make sure to run: pipx install snakeviz
profile() {
tmp_file=$(mktemp)
python -m cProfile -o $tmp_file "$@"
snakeviz $tmp_file
rm $tmp_file
}
### Keybase proof
I hereby claim:
* I am alexxv on github.
* I am alexxv (https://keybase.io/alexxv) on keybase.
* I have a public key whose fingerprint is 6842 68E6 B1FB BC46 3BBB F3FD 80B8 8915 7035 0C66
To claim this, I am signing this object:
Verifying that +alexv is my openname (Bitcoin username). https://onename.io/alexv
@alexxv
alexxv / DateParser.java
Created March 1, 2012 08:34
Date parser
final Parser p = new Parser();
List<String> strings = Files.readLines(new File("c:\\users\\alexv\\Desktop\\task_titles.tsv"), Charset.defaultCharset());
final Set<Character> chars = newHashSet(' ', '@', ':', '-');
final Set<String> good_last_words = newHashSet("on", "@", "by", "due", "date", "untill", "til", "till", "at", "for", "before", "after", "in");
Set<String> text_firsts = newHashSet("today", "tomorrow", "this", "next");
final Set<String> syntaxTreeBlackList = newHashSet("(DATE_TIME_ALTERNATIVE (DATE_TIME (EXPLICIT_TIME (HOURS_OF_DAY ) (MINUTES_OF_HOUR ))))", "tomorrow", "this", "next");
final Set<String> syntaxTreeWhiteList = newHashSet("(DATE_TIME_ALTERNATIVE (DATE_TIME (RELATIVE_DATE (SEEK > by_day (DAY_OF_WEEK )))))",
"(DATE_TIME_ALTERNATIVE (DATE_TIME (EXPLICIT_DATE (MONTH_OF_YEAR ) (DAY_OF_MONTH ))))",