Skip to content

Instantly share code, notes, and snippets.

@sherwind
sherwind / dns-records-fetcher.sh
Created November 9, 2023 08:42
Fetch DNS records of a domain name
#!/bin/bash
# This script performs DNS queries to collect records for a given domain.
# It queries for ANY and AXFR records, as well as 'A' records for common subdomains.
# If nameservers are provided as arguments, it uses those. Otherwise, it finds
# and uses the authoritative nameservers for the domain.
# by sherwin@daganato.com, 2003-03-15
# Check if at least the domain is provided
if [ "$#" -lt 1 ]; then
@sherwind
sherwind / expand_ebs_volume.yml
Created February 21, 2020 02:40
Using Ansible to expand an EBS volume
- hosts: server
vars:
vol_new_size: 50
vol_drive: /dev/sdf
tasks:
- name: Gathering ec2 metada facts
ec2_metadata_facts:
@sherwind
sherwind / prompt-AI-code-builder
Created June 3, 2023 07:40
Use AI to build an application from scratch using its creativity, logic and skills. The AI has to generate and evaluate different approaches, reflect on its choices, and write the code for the best approach. Adopted from https://twitter.com/mattshumer_/status/1663939227552215054?t=0-jzGHOVlcCQQ3NMcw
Adopt the role of Software Engineering Mastermind 🧠, a master of all aspects of software engineering, from design and development to security and testing to documentation and delivery.
I want you to build [Application to build].
To do so, you will:
1. First, reason about how you will approach this. Generate at least three possible approaches, and explain the pros and cons of each.
2. Then, ask yourself some questions to reflect on your approaches. For example: How feasible is each approach? How efficient is each approach? How creative is each approach? How can each approach be improved?
3. Next, evaluate your approaches based on your reflection. Assign a score to each approach from 1 to 10, where 10 is the best. Explain why you gave each score.
4. Finally, choose the best approach based on your evaluation. Write the code, file by file, in full.
@sherwind
sherwind / Pivot Points High Low Extension.pinescript
Created May 19, 2018 14:39
Pivot Points High Low Extension
//@version=3
//
// Pivot Points High Low Extension
//
// See Also:
// - A Simple 1-2-3 Method for Trading Forex <http://webinar.tradingpub.com/resources/lp/tpub_topshelf/Top_Shelf_Magazine/forex/A_Simple_1_2_3_Method_for_Trading_Forex.php>
// - The Classic 1-2-3 Pattern: An Underestimated Powerhouse <https://www.tradeciety.com/the-classic-1-2-3-pattern-underestimated-powerhouse/>
// - Bulkowski's 1-2-3 Trend Change <http://thepatternsite.com/123tc.html>
//
//
@sherwind
sherwind / ansible-awscli-gosu-Dockerfile
Last active January 27, 2023 06:39
Dockerfile for ansible + awscliv2 + gosu
## $ docker build -t myansible .
## $ export AWS_PROFILE="..."
## $ docker run -it --rm -e AWS_PROFILE \
## -e MY_UID=$(id -u) -e MY_GID=$(id -g) \
## -v ${HOME}/.aws/config:/home/user/.aws/config:ro \
## -v ${HOME}/.aws/credentials:/home/user/.aws/credentials:ro \
## -v ${HOME}/.ssh/:/home/user/.ssh/:ro \
## -v $(pwd):/work \
## --workdir=/work myansible ansible -i inventory all -m ping
@sherwind
sherwind / ZigZag HiLo.pinescript
Last active December 6, 2022 06:41
ZigZag HiLo
//@version=3
//
// Based on http://traders.com/documentation/feedbk_docs/2013/07/traderstips.html
//
//
// -----------------------------------------------------------------------------
// Copyright 2018 sherwind
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@sherwind
sherwind / rds-top.sh
Last active June 16, 2022 13:58 — forked from matheusoliveira/README.md
Get AWS RDS Enhanced Monitoring statistics from CloudWatch and show something similar to Linux top command
#!/bin/bash
# rds-top.sh
# by <sherwin@daganato.com>, 20190822
# based on the work of Matheus de Oliveira <matioli.matheus@gmail.com>
#
# Usage:
# ./rds-top.sh rds-instance
# ./rds-top.sh --start-time=$(date -v-13d +%s) rds-instance
# ./rds-top.sh --sort-by-mem --start-time=$(date -j -f "%Y-%m-%dT%H:%M:%S%z" "2019-09-12T13:05:00+0000" +%s) rds-instance | grep -v 'idle$'
@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 / 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 / alienvault-get_alarm.sh
Created May 27, 2021 07:39
Pulls an alarm and its events from AT&T's Alienvault USM Anywhere
#!/bin/bash
# Pulls an alarm and its events from AT&T's Alienvault USM Anywhere
# by Sherwin Daganato, 20210523
#
# USAGE:
# ./alienvault-get_alarm.sh https://<usm-host>.alienvault.cloud/#/alarm/5c931059-11cc-489d-b378-83f2d452fdf6
# ./alienvault-get_alarm.sh 5c931059-11cc-489d-b378-83f2d452fdf6
#
# Requires API Client credentials which can be created by:
#