Skip to content

Instantly share code, notes, and snippets.

Arul arulrajnet

View GitHub Profile
@arulrajnet
arulrajnet / .env
Created Feb 20, 2019
httpbin using docker-compose with requestlog
View .env
GUNICORN_CMD_ARGS=--capture-output --error-logfile - --access-logfile - --access-logformat '%(h)s %(t)s %(r)s %(s)s Host: %({Host}i)s}'
@arulrajnet
arulrajnet / SimpleHTTPServerWithUpload.py
Last active Sep 19, 2018 — forked from UniIsland/SimpleHTTPServerWithUpload.py
Simple Python Http Server with Upload
View SimpleHTTPServerWithUpload.py
#!/usr/bin/env python
"""Simple HTTP Server With Upload.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
"""
@arulrajnet
arulrajnet / Dockerfile
Created Mar 30, 2016
Docker container for lighttpd on port 8080.
View Dockerfile
FROM alpine:3.3
# referred from https://hub.docker.com/r/sebp/lighttpd/
MAINTAINER Arul <me@arulraj.net>
RUN apk add --update lighttpd \
&& rm -rf /var/cache/apk/* \
&& sed -i.bak "s/server.document-root/#server.document-root/g" /etc/lighttpd/lighttpd.conf \
&& echo server.document-root = var.basedir >> /etc/lighttpd/lighttpd.conf \
&& echo server.port = 8080 >> /etc/lighttpd/lighttpd.conf \
@arulrajnet
arulrajnet / GetStockInfo.py
Created Aug 20, 2015
Python script to get the stock current and history information from command line. Google Finance Data used. It will accept stock code and interval range as list.
View GetStockInfo.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from collections import namedtuple
from datetime import timedelta
import json
import datetime
import re
import sys
import getopt
@arulrajnet
arulrajnet / colors.py
Last active Oct 24, 2017 — forked from jossef/colors.py
python coloring for linux, based on this answer http://stackoverflow.com/a/26445590/3191896 and modified to make it more usable in a pythonic way.
View colors.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
class Color(object):
"""
reference from https://gist.github.com/Jossef/0ee20314577925b4027f and modified bit.
"""
def __init__(self, text, **user_styles):
@arulrajnet
arulrajnet / download_java.py
Last active Feb 23, 2017 — forked from LordH3lmchen/download_latest_java.py
Download Oracle Java JDK / JRE from the terminal in an interactive manner. Useful when you want to download java in non-gui environment.
View download_java.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
from urllib.request import Request, urlopen
except ImportError: # python 2
from urllib2 import Request, urlopen
import re
import os
@arulrajnet
arulrajnet / tor_ip_renew.py
Created May 3, 2015
TOR ip renew script using pytorctl https://github.com/aaronsw/pytorctl which is a python based module to interact with the Tor Controller.
View tor_ip_renew.py
from TorCtl import TorCtl
import urllib2
user_agent = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.7) Gecko/2009021910 Firefox/3.0.7'
headers={'User-Agent':user_agent}
def request(url):
def _set_urlproxy():
proxy_support = urllib2.ProxyHandler({"http" : "127.0.0.1:8118"})
opener = urllib2.build_opener(proxy_support)
@arulrajnet
arulrajnet / stockmarketindia.py
Last active Nov 26, 2018
Get the latest Index from BSE and NSE stock market. Python script using google finance open API http://finance.google.com/finance/info?client=ig&q=INDEXBOM:SENSEX
View stockmarketindia.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from collections import namedtuple
import json
try:
from urllib.request import Request, urlopen
except ImportError: # python 2
from urllib2 import Request, urlopen
@arulrajnet
arulrajnet / WhoHasLatestNav.py
Created May 1, 2015
Have curiosity to know how www.valueresearchonline.com updated their NAV value of a fund once the Market closed on 4:10PM every day. So I wrote a script to check the NAV value in Value Research, AMFI and Morningstar for a particular fund. Here that script...
View WhoHasLatestNav.py
# -*- coding: utf-8 -*-
__author__ = 'arul'
import requests, sys
from lxml import html
from bs4 import BeautifulSoup
vrs_value = "NA"
amfi_value = "NA"
@arulrajnet
arulrajnet / livecricketscore.sh
Last active Apr 9, 2019
Shell script to get a Live cricket score from www.espncricinfo.com. Just run this shellscript then select your match. when ever you want to know score open that terminal and see. Just simple as Dhoni's helicopter shot :D
View livecricketscore.sh
#/bin/bash
# Shell script to get a Live cricket score from www.espncricinfo.com
# To help Cricket fan DevOPS see the score on his Terminal.
# Thanks to ESPN SPORTS MEDIA LTD for their RSS feed.
#
# Author : Arul <mailto:me@arulraj.net>
function get_html() {
local html=$(curl -k -L -s $1)
echo "$html"
You can’t perform that action at this time.