Skip to content

Instantly share code, notes, and snippets.

@sherwind
sherwind / check_dnsbl.pl
Created August 4, 2010 08:38
A Nagios script that checks if a server is listed in a RBL
#!/usr/bin/perl -wT
# A Nagios script that checks if a server is listed in a RBL
# by Sherwin Daganato <sherwin@daganato.com>, 20070607
$|++;
use strict;
use Getopt::Long;
# --- BEGIN config
Name: phantomjs
Version: 2.0.0
Release: 1%{?dist}
Summary: A headless WebKit with JavaScript API
Group: Applications/Internet
License: BSD-3-Clause
URL: http://phantomjs.org
Source0: https://bitbucket.org/ariya/phantomjs/downloads/%{name}-%{version}-source.zip
# create
post '/users' => sub {
my $user = resultset('User')->new_result({});
my $form = SampleApp::Form::User->new;
$form->process(item => $user, params => { params });
if ($form->validated) {
sign_in $user;
deferred success => 'Welcome to the Sample App!';
@sherwind
sherwind / check_interface_bandwidth.pl
Created April 15, 2017 03:45
Nagios plugin to check network interface throughput
#!/usr/bin/env perl
# Nagios plugin to check network interface throughput
# by Sherwin Daganato, 20170415
use CHI;
use Time::HiRes qw(gettimeofday tv_interval);
use Cwd qw(realpath);
use Monitoring::Plugin;
use List::Util qw(max);
@sherwind
sherwind / floor_pivots-tradingview.js
Created January 23, 2018 16:43
An implementation of Floor Pivot Points for TradingView
{
// An implementation of Floor Pivot Points for TradingView
// by sherwin@daganato.com, 20180124
// See https://en.wikipedia.org/wiki/Pivot_point_(technical_analysis)
name: "Floor Pivots",
metainfo: {
_metainfoVersion: 27,
isTVScript: !1,
isTVScriptStub: !1,
is_hidden_study: !1,
@sherwind
sherwind / retry_cmd.sh
Created April 9, 2018 11:08
bash function to retry command
retry_cmd()
{
attempts=15
false
while [ "${?}" -gt 0 ]; do
if [ "${attempts}" -eq 0 ]; then
logger --tag "$0" -- "Failed to run $*: $output"
return
fi
@sherwind
sherwind / MRST Strategy v1.pinescript
Last active February 11, 2022 00:51
Mean-Reversion Swing Trading Strategy v1
//@version=3
//
// A port of the TradeStation EasyLanguage code for a mean-revision strategy described at
// http://traders.com/Documentation/FEEDbk_docs/2017/01/TradersTips.html
//
// "In “Mean-Reversion Swing Trading,” which appeared in the December 2016 issue of STOCKS & COMMODITIES, author Ken Calhoun
// describes a trading methodology where the trader attempts to enter an existing trend after there has been a pullback.
// He suggests looking for 50% pullbacks in strong trends and waiting for price to move back in the direction of the trend
// before entering the trade."
//
@sherwind
sherwind / Ichimoku Strategy.pinescript
Created April 15, 2018 03:43
Ichimoku Cloud Strategy
//@version=3
//
// Based on the trading strategy described at
// http://stockcharts.com/school/doku.php?id=chart_school:trading_strategies:ichimoku_cloud
//
// See Also:
// - Backtesting and forwardtesting (of TradingView Strategies) <https://www.tradingview.com/wiki/Strategies#Backtesting_and_forwardtesting>
// - 9 Mistakes Quants Make that Cause Backtests to Lie <https://blog.quantopian.com/9-mistakes-quants-make-that-cause-backtests-to-lie-by-tucker-balch-ph-d/>
// - When Backtests Meet Reality <http://financial-hacker.com/Backtest.pdf>
// - Why MT4 backtesting does not work <http://www.stevehopwoodforex.com/phpBB3/viewtopic.php?f=28&t=4020>
@sherwind
sherwind / USDJPY Assumption v1.pinescript
Last active April 21, 2018 11:18
USDJPY Assumption v1
//@version=3
//
// Based on the "logical trading" post of Charles Cornley (thanks!).
//
// Indicator States:
//
// Very Bullish (Lime) = USD trend rising and JPY trend falling and Gold trend falling and US 10Y Bond trend falling and
// Dow Jones trend rising and Nasdaq trend rising and Russell 2000 trend rising and
// S&P 500 trend rising and Nikkei 225 trend rising
//
@sherwind
sherwind / Trading the Loonie.pinescript
Created April 21, 2018 15:49
Trading the Loonie (CADUSD)
//@version=3
//
// A port of the trading strategy described at http://technical.traders.com/content/TTlink.asp?mo=12&yr=2015
//
// "In “Trading The Loonie,” which appeared in the December 2015 issue of STOCKS & COMMODITIES, author Markos Katsanos
// explains the heavy correlation between the Canadian dollar and crude oil. He then goes on to describe how one could
// trade this correlation. Using similar logic as that employed in Bollinger Bands, Katsanos has built a study to
// provide buy and sell signals for trading the Canadian dollar future."
//
// See Also: