Skip to content

Instantly share code, notes, and snippets.

View rahulmr's full-sized avatar
🏠
Working from home

Rahul Raut rahulmr

🏠
Working from home
View GitHub Profile
@rahulmr
rahulmr / headless.md
Created June 1, 2017 13:41 — forked from addyosmani/headless.md
So, you want to run Chrome headless.

Update May 2017

Eric Bidelman has documented some of the common workflows possible with headless Chrome over in https://developers.google.com/web/updates/2017/04/headless-chrome.

Update

If you're looking at this in 2016 and beyond, I strongly recommend investigating real headless Chrome: https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md

Windows and Mac users might find using Justin Ribeiro's Docker setup useful here while full support for these platforms is being worked out.

@rahulmr
rahulmr / phantomjsGoogleSearch
Created July 20, 2017 16:11 — forked from ndhu/phantomjsGoogleSearch
phantomjs. example on how to search google, collect links of search result and scrape multiple pages of the search result
/**
* Created by andy hulstkamp
*/
var webpage = require("webpage"),
fs = require("fs");
var debug = false,
pageIndex = 0,
allLinks = [],
@rahulmr
rahulmr / cloud-init-ms-windows.txt
Created August 4, 2017 09:57
Cloud Init MS Windows Poor Man Script Install Chocolatey and packages
#cloud-config
script: |
<powershell>
Try {
(new-object Net.WebClient).DownloadString("http://psget.net/GetPsGet.ps1") | iex
import-module PsGet
Install-Module PowerYaml
$userdata = (Get-Yaml (Invoke-RestMethod http://instance-data/latest/user-data))
}
Catch
# install 7-zip, curl and vim
# (Windows 2012 comes with .NET 4.5 out-of-the-box)
# Then use the EC2 tools to create a new AMI from the result, and you have a system
# that will execute user-data as a PowerShell script after the instance fires up!
# This has been tested on Windows 2012 64bits AMIs provided by Amazon (eu-west-1 ami-a1867dd6)
#
# Inject this as user-data of a Windows 2012 AMI, like this (edit the adminPassword to your needs):
#
# <powershell>
# Set-ExecutionPolicy Unrestricted
@rahulmr
rahulmr / hello.ps1
Created July 29, 2018 12:13 — forked from lukesampson/hello.ps1
A simple example for Scoop documentation.
$name = split-path (whoami) -leaf
"Hello, $name!"
@rahulmr
rahulmr / hello.ps1
Last active July 29, 2018 12:15
hello of my own
$name = split-path (whoami) -leaf
"Hello, $name!"
@rahulmr
rahulmr / user_authentication.py
Created May 26, 2020 23:56 — forked from jslvtr/user_authentication.py
Simple authentication with encryption using Flask and Python
"""
This file defines a User model and a Flask application, and implements authentication using encryption.
For more information, visit http://tecladocode.com/blog/learn-python-password-encryption-with-flask
"""
from flask import Flask, request, jsonify
from werkzeug.security import generate_password_hash, check_password_hash
import sqlite3
"""
Simple Moving Average implemented using KiteConnect Python library. -- [https://kite.trade](kite.trade)
Rainmatter (c) 2016
License
-------
This GIST is licensed under the MIT License
"""
from kiteconnect import KiteConnect
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rahulmr
rahulmr / influx_schema.sql
Created June 13, 2020 01:35 — forked from bbc4468/influx_schema.sql
Influx DB Schema for OHLC
create database price_history_db
CREATE CONTINUOUS QUERY "cq_1m" ON "price_history_db" BEGIN SELECT MIN(price) as low, MAX(price) as high, FIRST(price) as open, LAST(price) as close, SUM(size) as volume INTO "price_1m" FROM "trade" GROUP BY time(1m), symbol END
CREATE CONTINUOUS QUERY "cq_5m" ON "price_history_db" BEGIN SELECT MIN(low) as low, MAX(high) as high, FIRST(open) as open, LAST(close) as close, SUM(volume) as volume INTO "price_5m" FROM "price_1m" GROUP BY time(5m), symbol END
CREATE CONTINUOUS QUERY "cq_15m" ON "price_history_db" BEGIN SELECT MIN(low) as low, MAX(high) as high, FIRST(open) as open, LAST(close) as close, SUM(volume) as volume INTO "price_15m" FROM "price_5m" GROUP BY time(15m), symbol END
CREATE CONTINUOUS QUERY "cq_1h" ON "price_history_db" BEGIN SELECT MIN(low) as low, MAX(high) as high, FIRST(open) as open, LAST(close) as close, SUM(volume) as volume INTO "price_1h" FROM "price_15m" GROUP BY time(1h), symbol END
CREATE CONTINUOUS QUERY "cq_6h" ON "price_history_db" BEGIN SELECT