Skip to content

Instantly share code, notes, and snippets.

@darshitpp
darshitpp / url_encode_decode.sh
Created Apr 1, 2021
URL Encode/Decode from Bash/ZSH using Python 2.7 and Python 3
View url_encode_decode.sh
# Add the following in your ~/.bashrc or ~/.zshrc
# No need to visit urlencoder.org or urldecoder.org!!
# 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
darshitpp / epoch_utils.sh
Last active May 12, 2021
Useful Bash/ZSH Aliases and functions to get Epoch timestamps using Python 2.7 and Python 3
View epoch_utils.sh
# 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
darshitpp / change-java-version-ant.md
Created Jun 9, 2020
Changing Java Version for Ant Builds
View change-java-version-ant.md

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 Websites.md