Skip to content

Instantly share code, notes, and snippets.

View gpsarkar's full-sized avatar
💭
🚀

Ganapati Sarkar gpsarkar

💭
🚀
View GitHub Profile
@gpsarkar
gpsarkar / xvfb
Created April 15, 2017 08:09 — forked from jterrace/xvfb
xvfb init script for Ubuntu
XVFB=/usr/bin/Xvfb
XVFBARGS=":1 -screen 0 1024x768x24 -ac +extension GLX +render -noreset"
PIDFILE=/var/run/xvfb.pid
case "$1" in
start)
echo -n "Starting virtual X frame buffer: Xvfb"
start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile --background --exec $XVFB -- $XVFBARGS
echo "."
;;
stop)
#Sample task
task(){
sleep 0.5; echo "$1";
}
#Sequential runs
for thing in a b c d e f g; do
task "$thing"
@gpsarkar
gpsarkar / maintenance-mode.conf
Created June 30, 2017 17:10 — forked from rictorres/maintenance-mode.conf
nginx maintenance mode
server {
listen 80;
server_name mysite.com;
root /var/www/mysite.com/;
location / {
if (-f $document_root/maintenance.html) {
return 503;
}
... # the rest of your config goes here
pip install virtualenv
virtualenv venv
cd venv/Scripts
activate
pip install pandas
@gpsarkar
gpsarkar / 01-02.py
Created July 12, 2017 22:13 — forked from dimi-tree/01-02.py
Udacity: Machine Learning for Trading
# Working with multiple stocks
"""
SPY is used for reference - it's the market
Normalize by the first day's price to plot on "equal footing"
"""
import os
import pandas as pd
import matplotlib.pyplot as plt
@gpsarkar
gpsarkar / Technical Indicators without TA-lib.py
Created July 16, 2017 18:56 — forked from kevincdurand1/Technical Indicators without TA-lib.py
Technical Indicators without TA-lib #tags: Technical Indicators, Quant
import numpy
import pandas as pd
import math as m
#Moving Average
def MA(df, n):
MA = pd.Series(pd.rolling_mean(df['Close'], n), name = 'MA_' + str(n))
df = df.join(MA)
return df
@gpsarkar
gpsarkar / YahooDataGrabber.py
Created July 16, 2017 21:28
Simple scripts to bulk download historical data from Yahoo! Finance
#!/usr/bin/env python
import csv
import Queue
import threading
import ystockquote as ys
def gen_info_list(tickers, start, end):
'''
$webhook = "SLACK INCOMING WEBHOOK URL"
$attachments = @(@{
"pretext" = "Lab 7 Smoke Test"
"color"="danger"
"text"= "14/43 failed (5 mins)"
})
$payload =
@{
"attachments" = $attachments
@gpsarkar
gpsarkar / gist:0c4c97cd65c28b53f683854ffae7b16a
Created December 29, 2017 12:49
Install VS Code on CentOS
// RHEL, Fedora and CentOS based distributions
sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
sudo sh -c 'echo -e "[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/yum.repos.d/vscode.repo'
yum check-update
sudo yum install code
@gpsarkar
gpsarkar / powershell to rename string in files recursive
Created February 9, 2018 10:19
powershell to rename string in files recursive
Get-ChildItem -r -Depth 1 -include "web.config" |
foreach-object { $a = $_.fullname; ( get-content $a ) |
foreach-object { $_ -replace "oldstring","newstring" } |
set-content $a }