Skip to content

Instantly share code, notes, and snippets.

View syuraj's full-sized avatar
🏠
Working from home

Suraj Shrestha syuraj

🏠
Working from home
View GitHub Profile
@syuraj
syuraj / gist:8ea91a9826005f5d15c11292de23842b
Created March 3, 2025 17:39
Default AWS Config rules
resource "aws_config_config_rule" "account_part_of_organizations" {
name = "account-part-of-organizations"
description = "Rule checks whether AWS account is part of AWS Organizations. The rule is NON_COMPLIANT if the AWS account is not part of AWS Organizations or AWS Organizations master account ID does not match rule parameter MasterAccountId."
source {
owner = "AWS"
source_identifier = "ACCOUNT_PART_OF_ORGANIZATIONS"
}
@syuraj
syuraj / unsubscribe-all.js
Last active February 2, 2025 16:36
Youtube Unsubscribe All Script
// go to this link https://www.youtube.com/feed/channels
// run code below in browser console
(async () => {
const delay = (ms) => new Promise(res => setTimeout(res, ms));
let buttons = document.querySelectorAll('ytd-subscribe-button-renderer yt-button-shape button');
for (let button of buttons) {
if (button.innerText.trim().toLowerCase() === "subscribed") {
@syuraj
syuraj / remove_github_stars.sh
Created December 16, 2023 02:59
remove_github_stars.sh
#!/usr/bin/env bash
# source: https://gist.github.com/justlaputa/a6da84981eca963817e652b5f2452cfc
set -o errexit
set -o pipefail
set -o nounset
STARS_PAGE_COUNT=20
STARS_FILE=stars.txt
DELETE_SLEEP_TIME=.5
@syuraj
syuraj / HTF-Candle.pine
Last active October 23, 2023 03:12
HTF Candle R1.2 by JustUncleL
//@version=5
indicator("HTF Candle R1.2 by JustUncleL", shorttitle="HTF Candle", overlay=true)
//
// Author: JustUncleL
// Date: 9-Nov-2017
// Version: R1.2
//
// Description:
@syuraj
syuraj / Backtrader_SuperTrend.py
Created September 20, 2023 02:46
Backtrader SuperTrend Indicator
class SuperTrend(bt.Indicator):
lines = ('super_trend',)
params = (
('multiplier', 12.0),
('atr_period', 3),
)
def __init__(self):
self.isDownTrend = -1
self.isUpTrend = 1
@syuraj
syuraj / Install-Spinnaker-Locally.md
Last active March 5, 2022 20:04
Install Spinnaker Locally (quick steps)

Notes: Install halyard, kubernetes (eg. docker-desktop from docker). Also need an aws account for storage (unless using minio)

  • Enable Kubernetes:
    • hal config provider kubernetes enable
  • Add account:
    • hal config provider kubernetes account add local-spinnaker --context docker-desktop
    • docker-desktop is local docker context
  • Enable artifacts:
    • hal config features edit --artifacts true
  • Set storage:
@syuraj
syuraj / Local-Spinnaker-using-Helm.md
Created March 5, 2022 19:36
Install Local Spinnaker using helm chart
To prevent wall messages from messing up all of your open terminals:
sudo systemctl stop systemd-ask-password-wall.service
sudo systemctl stop systemd-ask-password-wall.path
To make this change persistent over boot:
sudo systemctl mask systemd-ask-password-wall.service
sudo systemctl mask systemd-ask-password-wall.path
import { useState, useEffect } from 'react';
import { Storage } from '@ionic/storage';
const storage = new Storage();
storage.create();
export const useIonicStorage = (key, defaultValue) => {
const [value, setValue] = useState(defaultValue);
useEffect(() => {
@syuraj
syuraj / python_postgres_getting_started.py
Created June 20, 2020 03:34
Python Postgres Getting Started
import psycopg2
try:
connection = psycopg2.connect("postgres://postgres:@localhost:5432/postgres")
cursor = connection.cursor()
# create_table_query = '''CREATE TABLE mobile
# (ID INT PRIMARY KEY NOT NULL,
# MODEL TEXT NOT NULL,