Skip to content

Instantly share code, notes, and snippets.

View ranaroussi's full-sized avatar

Ran Aroussi ranaroussi

View GitHub Profile
@ranaroussi
ranaroussi / mac-quick-screenshare
Created April 17, 2017 07:42 — forked from shedali/mac-quick-screenshare
applescript to start screen recording using quicktime
tell application "QuickTime Player" to activate
tell application "System Events"
activate
--set UI elements enabled to true
tell process "QuickTime Player"
click menu item "New Screen Recording" of menu "File" of menu bar 1
end tell
end tell
tell application "QuickTime Player"
SHEET_NAME="Sheet1"
URL="https://data.sparkfun.com/output/VFEEYZENwLCNwE8LZjDA.csv"

function myFunction() {
  ScriptApp.newTrigger("getData")
  .timeBased()
  .everyMinutes(1)
  .create();
}
@ranaroussi
ranaroussi / PHP "requests"
Last active February 24, 2018 09:14
curl "requests" (php)
<?php
/**
* PHP implementation of Pyton's requests module
* Copyright 2017-2018 Ran Aroussi
*
* Licensed under the GNU Lesser General Public License, v3.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/lgpl-3.0.en.html
@ranaroussi
ranaroussi / alphavantage.py
Created March 15, 2018 10:07
API client for AlphaVantage (stocks only atm) - https://www.alphavantage.co
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import pandas as pd
from urllib.parse import urlencode
class AlphaVantage(object):
def __init__(self, api_key):

Keybase proof

I hereby claim:

  • I am ranaroussi on github.
  • I am ranaroussi (https://keybase.io/ranaroussi) on keybase.
  • I have a public key ASA6RgWZK5het4zvK722ATQfHG0lqH6iUX2IQrwVtsuZ0Qo

To claim this, I am signing this object:

@ranaroussi
ranaroussi / cloudSettings
Last active March 29, 2022 10:28
Visual Studio Code Settings Sync Gist
{"lastUpload":"2022-03-29T10:27:38.273Z","extensionVersion":"v3.4.3"}
@ranaroussi
ranaroussi / get_active_contracts.py
Created May 20, 2019 12:18
get active futures contract
#!/usr/bin/env python
from dateutil.parser import parse as parse_date
import datetime
import requests
import pandas as pd
def get_contracts(url):
html = requests.get(url, timeout=5)
@ranaroussi
ranaroussi / runner.py
Created August 19, 2019 17:39
Python Job Runner
#!/usr/bin/env python
import subprocess
import time
import sys
import logging
class Job:
"""
monitors that a job is running and executing it when it's not
@ranaroussi
ranaroussi / resampler.py
Created September 18, 2019 12:57
QTPyLib timeseries resampler
import pandas as pd
def resample(data, resolution="1T", tz=None, ffill=True, dropna=False):
"""
>>> resample(df, '500K') # resample 500 ticks (by counting trades)
>>> resample(df, '500V') # resample ~500 volume (by counting volume)
"""
def __finalize(data, tz=None):
# figure out timezone
@ranaroussi
ranaroussi / nasdaq_premarket.py
Last active November 18, 2021 20:18
gets premarket prices from nasdaq
import requests
def get_premarket(ticker):
"""
gets premarket prices from nasdaq
usage:
>> price, volume = get_premarket('spy')
"""