Skip to content

Instantly share code, notes, and snippets.

@denistex
denistex / custom-sma.pine
Created June 4, 2020 09:53
Custom SMA that duplicates the last bar
//@version=4
study("Custom SMA")
CustomSma(source, length) =>
sum = source
for i = 0 to length - 2
sum := sum + source[i]
sum / length
plot(sma(close, 14))
@denistex
denistex / sessions.pine
Created June 3, 2020 18:06
StackOverflow Answer
//@version=4
// https://stackoverflow.com/questions/62162866/problem-plotting-line-at-price-coordinates/62165505
study("Sessions",overlay=true)
t1 = timestamp("GMT", year, month, dayofmonth, 0, 00, 00)
t2 = timestamp("GMT-5", year, month, dayofmonth, 0, 00, 00)
backLook = 86400000 * 1.5
displayCondition = timeframe.isdwm == false and (time > timenow - backLook)
@denistex
denistex / use-antd-scss-theme-plugin.js
Created May 4, 2020 16:33
Rescript to connect antd-scss-theme-plugin correctly
'use strict'
const { getPaths, edit } = require('@rescripts/utilities')
const loaderUtils = require('loader-utils')
const path = require('path')
const paths = require('react-scripts/config/paths')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const AntdScssThemePlugin = require('@atbtech/antd-scss-theme-plugin')
@denistex
denistex / autohalt.sh
Last active July 28, 2017 10:02
Bash script for automated shutting down if there are no active sessions
#!/bin/bash
# Copy script to `/etc/cron.hourly/autohalt` (*without extension*).
# Log and pid files will be placed in root directory.
DELAY=${1:-30} # minutes
LOG=${2:-"autohalt.log"}
PID=${2:-"autohalt.pid"}
function log {
@denistex
denistex / Dockerfile
Last active July 19, 2017 17:10
Containerized version of AWS CLI
# Containerized version of AWS CLI.
#
# docker build -t awscli .
#
FROM debian:9
MAINTAINER Denis T. <dev@denis-it.com>
RUN apt-get update && \
apt-get install --no-install-recommends -y awscli
@denistex
denistex / envelope-metainfo.js
Created July 10, 2017 19:36
Example of custom study meta info in Trading View Charting LIbrary
{
_metainfoVersion: 27,
isTVScript: false,
isTVScriptStub: false,
is_hidden_study: false,
defaults: {
styles: {
plot_0: {
linestyle: 0,
linewidth: 1,
@denistex
denistex / aws-vnc.md
Last active November 6, 2021 09:51
How to configure Debian with i3wm and VNC access in AWS cloud

Instance configuration

  1. Add PEM file in AWS (if you don't have one).
  2. Set PEM file permissions: chmod 600 PEMFILE.
  3. Create new Debian instance in AWS console.
  4. Update instance credentials in following scripts:
    • up-instance.sh
    • dn-instance.sh
    • ssh2aws.sh
    • scp2aws.sh
@denistex
denistex / 00-akka-in-action.md
Last active May 25, 2017 09:53
Concise content of "Akka in Action" book

"Akka in Action" Short Terms