Skip to content

Instantly share code, notes, and snippets.

@devster31
devster31 / tasks.jsonc
Created Feb 11, 2020
yamllint Visual Studio Code task
View tasks.jsonc
{
// 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": [
View issue.md
SUMMARY

query is not returning an empty list.

ISSUE TYPE
  • Bug Report
View hyper.js
// 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 Feb 23, 2019
ssh-agent automation done well
View joseph_reagle.bash
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 Feb 25, 2018
messy post-processing
View post-script.sh
#!/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
View subproc.py
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='')
View strategies.md

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 Jan 23, 2022
[Beets Docker] #config #software
View Dockerfile
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 Aug 16, 2017
Bash script to setup a temporary SSH tunnel
View ssh-tunnel.md

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 Aug 16, 2017
Transmission script to clean completed downloads
View transmission-purge-completed.sh
#!/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