Skip to content

Instantly share code, notes, and snippets.

@devster31
devster31 / tasks.jsonc
Created February 11, 2020 00:43
yamllint Visual Studio Code task
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "yamllint",
"type": "shell",
"command": "/usr/local/bin/yamllint",
"args": [
SUMMARY

query is not returning an empty list.

ISSUE TYPE
  • Bug Report
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// choose either `'stable'` for receiving highly polished,
// or `'canary'` for less polished but more frequent updates
updateChannel: 'stable',
@devster31
devster31 / joseph_reagle.bash
Last active February 23, 2019 02:09
ssh-agent automation done well
SSH_ENV="$HOME/.ssh/environment"
function start_agent {
echo "Initialising new SSH agent..."
/usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
echo succeeded
chmod 600 "${SSH_ENV}"
. "${SSH_ENV}" > /dev/null
/usr/bin/ssh-add;
}
@devster31
devster31 / post-script.sh
Created February 25, 2018 16:45
messy post-processing
#!/bin/bash -u
MEDUSA_API_KEY=*****
file=$1 # {f}
location=$2 # {f.dir.dir}
database=${3} # {info.DataBase}
id=${4:-x} # {info.id}
name="${5}" # {info.Name}
if [[ ! -f "$1" ]]; then
from subprocess import Popen, PIPE
def run_command():
with Popen(['pp3.py'], stdout=PIPE, stderr=PIPE, bufsize=1, universal_newlines=True) as p:
while p.poll() is None:
out = p.stdout.readline()
err = p.stderr.readline()
print(out, end='')
print(err, end='')

Strategies

The trend_ema strategy (default)

  • The default strategy is called trend_ema and resides at ./extensions/strategies/trend_ema.
  • Defaults to using a 2m period, but you can override this with adding e.g. --period=5m to the sim or trade commands.
  • Computes the 26-period EMA of the current price, and calculates the percent change from the last period's EMA to get the trend_ema_rate
  • Considers trend_ema_rate >= 0 an upwards trend and trend_ema_rate < 0 a downwards trend
  • Filters out low values (whipsaws) by neutral_rate, which when set to auto, uses the standard deviation of the trend_ema_rate as a variable noise filter.
  • Buys at the beginning of upwards trend, sells at the beginning of downwards trend
@devster31
devster31 / Dockerfile
Last active January 8, 2023 02:16
[Beets Docker] #config #software
FROM lsiobase/alpine
ARG VERSION
ARG AUDIOTOOLS_VERSION
ENV \
BEETS_VERSION="$VERSION" \
AUDIOTOOLS_VERSION="$AUDIOTOOLS_VERSION" \
# environment settings
BEETSDIR="/config" \
@devster31
devster31 / ssh-tunnel.md
Created August 16, 2017 12:00
Bash script to setup a temporary SSH tunnel

You can do this cleanly with an ssh 'control socket'. To talk to an already-running SSH process and get it's pid, kill it etc. Use the 'control socket' (-M for master and -S for socket) as follows:

$ ssh -M -S my-ctrl-socket -fnNT -L 50000:localhost:3306 jm@sampledomain.com
$ ssh -S my-ctrl-socket -O check jm@sampledomain.com
Master running (pid=3517) 
$ ssh -S my-ctrl-socket -O exit jm@sampledomain.com
Exit request sent. 

Note that my-ctrl-socket will be an actual file that is created.

@devster31
devster31 / transmission-purge-completed.sh
Created August 16, 2017 11:58
Transmission script to clean completed downloads
#!/bin/sh
# the folder to move completed downloads to
# port, username, password
SERVER="9091 --auth transmission:transmission"
# use transmission-remote to get torrent list from transmission-remote list
# use sed to delete first / last line of output, and remove leading spaces
# use cut to get first field from each line