Skip to content

Instantly share code, notes, and snippets.

darshitpp /
Created Apr 1, 2021
URL Encode/Decode from Bash/ZSH using Python 2.7 and Python 3
# Add the following in your ~/.bashrc or ~/.zshrc
# No need to visit or!!
# Python 2.7
# >url_encode 'Hello, this is me'
# >=====
# Hello%2C%20this%20is%20me
url_encode() {
python -c "import urllib; print '=====\n' + urllib.quote_plus('$1')"
darshitpp /
Last active May 12, 2021
Useful Bash/ZSH Aliases and functions to get Epoch timestamps using Python 2.7 and Python 3
# Add the following to your ~/.bashrc or ~/.zshrc
# prints current epoch in milliseconds
# >epoch
# >1616738907653
alias epoch='python -c "from time import time; print int(round(time() * 1000))"'
# prints current epoch in human readable date in UTC timezone
# >utc
# >2021-03-26 06:08:27.653000
darshitpp /
Created Jun 9, 2020
Changing Java Version for Ant Builds

Want to change Java Version/JAVA_HOME for Ant builds?

  1. Open ~/.antrc file by running vim ~/.antrc
  2. Add JAVACMD=<NEW_JAVA_HOME>/bin/java and save

The Ant wrapper script for Unix will source (read and evaluate) the file ~/.antrc before it does anything. On Windows, the Ant wrapper batch-file invokes %HOME%\antrc_pre.bat at the start and %HOME%\antrc_post.bat at the end. You can use these files, for example, to set/unset environment variables that should only be visible during the execution of Ant.

>The wrapper scripts use the following environment variables (if set):

View Remote Work