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
# You will need to have jq (http://stedolan.github.io/jq/) and wget/curl installed on your system before being able to use this script. | |
# | |
# Usage: Include the following bash snippet in your ~/.bashrc file, or save as a separate file and source it. | |
# | |
# Example prompt generated by the script: | |
# abiyani@vaio:~ [BEL-2-1-ALG, RUS-1-1-KOR, BRA-0-0-MEX] | |
# | |
# Note: By default it display score for only active matches, and if there is no active match at the moment, then prompt remains unchanged. | |
function get_scores() { |
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
#!/bin/bash | |
# Usage: | |
# ./bing_search.bash [max_random_wait_in_seconds=5] [cookie_file_path] | |
set -e | |
function ensureCookieFile() { | |
local mpath=~/.mozilla/firefox | |
cf="$(find "$mpath" -name "cookies.sqlite" -type f -print0 | xargs -0 stat --format '%Y :%y %n' | sort -nr | rev | head -n 1 | cut -f 1 -d ' ' | rev)" | |
if [[ -z "$cf" ]]; then | |
echo -e "\nUnable to find file 'cookies.sqlite' inside the source tree '${mpath}' -- will exit\n" >&2 | |
exit 1 |
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
# Removes redundant entries from the input (which is assumed to be a "PATH"-like string) | |
# Input: Exactly one argument ($1): a PATH-like string, which will be de-deuplicated | |
# Output: Prints the deduplicated string on stdout (can be captured using command substitution by caller) | |
# | |
# Notes: | |
# - Assumes colon (:) as the delimiter character. | |
# - The only assumption regarding actual pathnames within the input string is that they won't | |
# contain the delimiter character (':') - this shouldn't be a problem, because bash will | |
# anyway split on ":" unconditionally (http://stackoverflow.com/a/14661492/1857518). Any other | |
# valid pathname character (whitespaces, non-printable ascii values, etc) are ok (modulo some other |