Powershell script to to test simple lis
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import datetime | |
import numpy as np | |
import talib | |
import alpaca_trade_api as tradeapi | |
api = tradeapi.REST(key_id=<your key id>,secret_key=<your secret key>) | |
barTimeframe = "1H" # 1Min, 5Min, 15Min, 1H, 1D | |
assetsToTrade = ["SPY","MSFT","AAPL","NFLX"] | |
positionSizing = 0.25 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import alpaca_trade_api as tradeapi | |
api = tradeapi.REST(key_id=<your key id>,secret_key=<your secret key>) | |
storageLocation = "<your folder location>" | |
barTimeframe = "1H" # 1Min, 5Min, 15Min, 1H, 1D | |
assetsToDownload = ["SPY","MSFT","AAPL","NFLX"] | |
iteratorPos = 0 # Tracks position in list of symbols to download | |
assetListLen = len(assetsToDownload) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @author Crend King | |
// @contributor Franz Alex Gaisie-Essilfie | |
// @version 2.4.20170620 | |
// @name Textarea Backup with expiry Fix | |
// @namespace http://users.soe.ucsc.edu/~kjin | |
// @description Fix @grant https://greasyfork.org/zh-CN/forum/discussion/8161 | |
// @description Retains text entered into textareas and contentEditables, and expires after certain time span. | |
// @include http://* | |
// @include https://* |
#SOLID Principles with ruby examples
##SRP - Single responsibility principle A class should have only a single responsibility.
Every class should have a single responsibility, and that responsibility should be entirely encapsulated. All its services should be narrowly aligned with that responsibility, this embrace the high cohesion.
##OCP - Open/closed principle Software entities should be open for extension, but closed for modification.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Encoding: utf-8 | |
# | |
# idle.rb | |
# | |
# goal: | |
# Ruby script to test how to fetch IMAP mails with IDLE mode. | |
# IMAP IDLE allow a sort of "push" / "real-time" delivery. | |
# | |
# I used the script to test LATENCY (end-to-end delivery times) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
## Update fail2ban iptables with globally known attackers. | |
## Actually, runs 100% independently now, without needing fail2ban installed. | |
## | |
## /etc/cron.daily/sync-fail2ban | |
## | |
## Author: Marcos Kobylecki <[email protected]> | |
## http://www.reddit.com/r/linux/comments/2nvzur/shared_blacklists_from_fail2ban/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This Shiny application is designed to help analysing trading strategies. It is an ongoing project that I improve when time allows. Feel free to get in touch should you have any suggestion. | |
*How to use the App as it is? | |
The App uses as input several csv files (one for each strategy). Each file has two columns: date and daily return. There is an example of such a file in the Github repository. The code is essentially made of 3 files. | |
-ui.R: controls the layout and appearance of the app | |
-server.R: contains the instructions needed to build the app. You can load as much strategies as you want as long as the corresponding csv file has the right format (see below). | |
-shinyStrategyGeneral.R: loads the required packages and launches the app | |
put ui.R and server.R file in a separate directory | |
In the server.R file change the inputPath, inputFile and keepColumns parameters to match your setting. The first two are self explanatory the third one is a list of column names within the csv file. Keep only date and daily return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo systemctl poweroff | |
Failed to start poweroff.target: Connection timed out | |
$ sudo shutdown -h now | |
Failed to start poweroff.target: Activation of org.freedesktop.systemd1 timed out | |
Failed to open /dev/initctl: No such device or address | |
Failed to talk to init daemon. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hash = { 'foo' => 'bar' } | |
# Version 1 | |
hash = Hash[hash.map { |k, v| [k.to_sym, v] }] | |
# Version 2 | |
hash = hash.reduce({}) do |memo, (k, v)| | |
memo.tap { |m| m[k.to_sym] = v } | |
end |
NewerOlder