This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# MIT License | |
# Copyright (c) 2016 Chandler Abraham | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
# copies of the Software, and to permit persons to whom the Software is | |
# furnished to do so, subject to the following conditions: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dateToMillis() { | |
#date as YYYY-MM-DD | |
echo $((`gdate -d $1 +%s` * 1000)) | |
} | |
millisToDate() { | |
gdate -d @`echo $(( $1 / 1000 ))` | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Snippets of code that work in Java 8. | |
// I've compiled these based on problems solved at: | |
// leetcode.com, interviewbit.com, firecode.io, hackerrank.com | |
// I strongly recommend you get a Java REPL to play around with some of this code | |
// (https://github.com/albertlatacz/java-repl) | |
// You can also use the jshell to run all these commands | |
// All following lines can be run in a Java REPL | |
// Note: If you see multiple lines of code, it's better to paste each line separately, just sayin' |