Skip to content

Instantly share code, notes, and snippets.

View ranaroussi's full-sized avatar

Ran Aroussi ranaroussi

View GitHub Profile
@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
SHEET_NAME="Sheet1"
URL="https://data.sparkfun.com/output/VFEEYZENwLCNwE8LZjDA.csv"

function myFunction() {
  ScriptApp.newTrigger("getData")
  .timeBased()
  .everyMinutes(1)
  .create();
}
@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"
@ranaroussi
ranaroussi / gist:557b9615ff79d98ec3bb7f4032bbedf7
Last active February 28, 2017 10:50
Example of a rapid prototyping of a strategy idea
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
example of a rapid prototyping of a strategy idea using pandas
(c) Ran Aroussi <http://aroussi.com>
"""
import matplotlib.pyplot as plt
from pandas_datareader import data
@ranaroussi
ranaroussi / plot_candlestick.py
Last active July 28, 2019 18:29
plot_candlestick
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
# future-compatibility with Panda 0.25
from pandas.plotting import register_matplotlib_converters
register_matplotlib_converters()
import numpy as np
@ranaroussi
ranaroussi / df_to_file.py
Last active December 14, 2016 07:30
A Generic method to save Pandas objects to file, based on file extension found in the output path.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
A Generic method to save Pandas objects to file,
based on file extension found in the output path.
Usage:
df.to_file("/path/to/file.csv")
"""
@ranaroussi
ranaroussi / ezibpy-stock-braket.py
Last active October 15, 2016 11:22
using ezIBpy to create a bracket order for AAPL
import ezibpy
import time
# initialize ezIBpy
ibConn = ezibpy.ezIBpy()
ibConn.connect(clientId=100, host="localhost", port=4001)
# create a contract
contract = ibConn.createStockContract("AAPL")
@ranaroussi
ranaroussi / ezibpy-callback
Last active June 1, 2017 15:23
ezIBpy: Tick Callback Example (repo: https://github.com/ranaroussi/ezibpy)
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import ezibpy
import time
# ---------------------
# create a callback method to be called on every tick/bid/ask
def ibCallback(caller, msg, **kwargs):
if "tick" in kwargs:
@ranaroussi
ranaroussi / eurusd_order.py
Last active March 5, 2023 11:10
order EUR.USD using ezIBpy
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import ezibpy
import time
# initialize ezIBpy
ibConn = ezibpy.ezIBpy()
ibConn.connect(clientId=1234, host="localhost", port=7497)
@ranaroussi
ranaroussi / encrypt_decrypt.sh
Created August 29, 2016 20:20
openssl encrypt/decrypt shortcuts (for .bashrc/.bash_aliases)
# encrypt/descrupy
encrypt(){
if [ -z "$1" ]
then
echo "Missing argument: Use encrypt [in] [out]"
else
if [ -z "$2" ]
then
cp $1 /tmp/$1
openssl enc -aes-256-cbc -e -in /tmp/$1 -out $1