Skip to content

Instantly share code, notes, and snippets.

View farooqarahim's full-sized avatar
:octocat:

Farooq A Rahim farooqarahim

:octocat:
View GitHub Profile
@farooqarahim
farooqarahim / TradingCube : Moving Average : Data table.js
Created March 6, 2024 23:55
A Tradingview Indicator, Plots moving average both EMA as well as SMA on Multiple timeframes at once in a Tabular Format for rapid indication of momentum shift as well as slower-moving confirmations.
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © tradingcube
//@version=5
indicator(title='TradingCube : Moving Average : Data table', shorttitle='Moving Average : Data table', overlay=true, precision=1)
htf_tf = input.string('Auto', 'Table Timeframe', options=['Auto', '5 Min','10 Min', '15 Min', '1 Hour', '4 Hour', 'Daily', 'Weekly', 'Monthly', 'Quarterly', 'Yearly'])
htf = htf_tf == '5 Min' ? '5' : htf_tf == '10 Min' ? '10' : htf_tf == '15 Min' ? '15' : htf_tf == '1 Hour' ? '60' : htf_tf == '4 Hour' ? '240' : htf_tf == 'Daily' ? 'D' : htf_tf == 'Weekly' ? 'W' : htf_tf == 'Monthly' ? 'M' : htf_tf == 'Quarterly' ? '3M' : htf_tf == 'Yearly' ? '12M' :
timeframe.isintraday and (timeframe.period == '1' or timeframe.period == '3' or timeframe.period == '5' or timeframe.period == '15') ? 'D' :
timeframe.isintraday and (timeframe.period == '30' or timeframe.period == '45' or timeframe.period == '60' or timeframe.period ==
@farooqarahim
farooqarahim / build_document_x.py
Last active April 21, 2023 09:30
Create a word document [A4] using photos from a folder.
# !pip install python-docx Pillow
import os
from docx import Document
from docx.shared import Inches
from docx.enum.text import WD_ALIGN_PARAGRAPH
from PIL import Image
def build_document(images_folder_path, output_path, columns, rows, add_text):
# List all files in the folder
@farooqarahim
farooqarahim / geckodriver-install.sh
Created May 30, 2022 04:02 — forked from cgoldberg/geckodriver-install.sh
download and install latest geckodriver for linux or mac (selenium webdriver)
#!/bin/bash
# download and install latest geckodriver for linux or mac.
# required for selenium to drive a firefox browser.
install_dir="/usr/local/bin"
json=$(curl -s https://api.github.com/repos/mozilla/geckodriver/releases/latest)
if [[ $(uname) == "Darwin" ]]; then
url=$(echo "$json" | jq -r '.assets[].browser_download_url | select(contains("macos"))')
elif [[ $(uname) == "Linux" ]]; then
url=$(echo "$json" | jq -r '.assets[].browser_download_url | select(contains("linux64"))')
@farooqarahim
farooqarahim / 1.js
Created February 11, 2021 20:11 — forked from getify/1.js
creating hard-bound methods on classes
class Foo {
constructor(x) { this.foo = x; }
hello() { console.log(this.foo); }
}
class Bar extends Foo {
constructor(x) { super(x); this.bar = x * 100; }
world() { console.log(this.bar); }
}
@farooqarahim
farooqarahim / pyspark_read_csv.py
Created January 7, 2021 19:04
PySpark Read CSV
import findspark
findspark.init()
from pyspark.sql import SparkSession
# Connect to Remote Spark Deployment
# spark = SparkSession \
# .builder.master('spark://master-node:7077') \
# .appName("read-csv") \
# .getOrCreate()
@farooqarahim
farooqarahim / README.md
Created October 14, 2020 00:53 — forked from pbojinov/README.md
Two way iframe communication- Check out working example here: http://pbojinov.github.io/iframe-communication/

Two way iframe communication

The main difference between the two pages is the method of sending messages. Recieving messages is the same in both.

Parent

Send messages to iframe using iframeEl.contentWindow.postMessage Recieve messages using window.addEventListener('message')

iframe

@farooqarahim
farooqarahim / gulpfile.js
Last active May 15, 2020 10:03
Gulp 4, Browserify transform for Babel & Watchify
const { watch, dest, series, parallel } = require('gulp');
const sourcemaps = require('gulp-sourcemaps');
const terser = require('gulp-terser-js');
const browserify = require('browserify');
const watchify = require('watchify');
const babelify = require('babelify');
const source = require('vinyl-source-stream');
const buffer = require('vinyl-buffer');
function Task() {
@farooqarahim
farooqarahim / somedomain.com.conf
Last active January 17, 2020 02:24
Nginx : Ghost SSL Config
#Nginx Ghost Config
server {
listen 80;
server_name somedomain.com;
rewrite ^(.*) https://$host$1 permanent;
}
# the secure nginx server instance
server {
listen 443 ssl;
@farooqarahim
farooqarahim / rabbitmq.txt
Created September 19, 2018 08:37
Create a new Admin User on rabbitmq
rabbitmqctl add_user username password
rabbitmqctl set_user_tags username administrator
rabbitmqctl set_permissions -p / username ".*" ".*" ".*"
@farooqarahim
farooqarahim / index.js
Created May 27, 2018 22:52
Get list of all users in Telegram channel / supergroup
/*
* MIT License
*
* Copyright (c) 2017-2018 Bannerets <save14@protonmail.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is