Skip to content

Instantly share code, notes, and snippets.

@nishanttotla
nishanttotla / html-table-to-csv.py
Created April 11, 2017 06:51
Python example to scrape web data
# Source: https://stackoverflow.com/questions/22018003/converting-html-table-to-csv-file-from-shell
# Reference: https://stackoverflow.com/questions/5214578/python-print-string-to-text-file
from BeautifulSoup import BeautifulSoup
import csv
import requests
outputfile = "allthedata.csv"
csvfile = open(outputfile, 'wb')
fout = csv.writer(csvfile, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL)
@nishanttotla
nishanttotla / .bashrc
Last active January 26, 2017 23:11
Persistent history across all bash terminals
# this part is used to record persistent bash history across terminals
# check http://eli.thegreenplace.net/2013/06/11/keeping-persistent-history-in-bash/ for details
HISTTIMEFORMAT="%d/%m/%y %T "
log_bash_persistent_history()
{
[[
$(history 1) =~ ^\ *[0-9]+\ +([^\ ]+\ [^\ ]+)\ +(.*)$
]]
local date_part="${BASH_REMATCH[1]}"

Keybase proof

I hereby claim:

  • I am nishanttotla on github.
  • I am nishanttotla (https://keybase.io/nishanttotla) on keybase.
  • I have a public key ASDkYycRrCHw-CZcWKJ8Wyfeg_rjc6KfXpUBp6vpmxrRjQo

To claim this, I am signing this object:

@nishanttotla
nishanttotla / swarm-with-docker-machine.sh
Last active May 24, 2019 11:57
A bash script to set up a simple Docker Swarm cluster using Docker Machine
################################## INSTRUCTIONS ##################################
# 1. Make sure docker-machine is installed on your machine #
# 2. Download the file #
# 3. Run using $ . swarm-with-docker-machine.sh so that DOCKER_HOST is exported #
##################################################################################
# Remove any existing machines
docker-machine rm -y manager agent1 agent2
# Create machines