Skip to content

Instantly share code, notes, and snippets.

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

Mohammad gr8linux

🏠
Working from home
View GitHub Profile
@gr8linux
gr8linux / cleanup.sh
Created August 22, 2021 20:08 — forked from superseb/cleanup.sh
Cleanup host added as custom to Rancher 2.0
#!/bin/sh
docker rm -f $(docker ps -qa)
docker volume rm $(docker volume ls -q)
cleanupdirs="/var/lib/etcd /etc/kubernetes /etc/cni /opt/cni /var/lib/cni /var/run/calico /opt/rke"
for dir in $cleanupdirs; do
echo "Removing $dir"
rm -rf $dir
done
@gr8linux
gr8linux / clean-node.sh
Created August 22, 2021 20:08 — forked from janeczku/clean-node.sh
Cleanup custom Rancher node
#!/bin/bash
user=$EUID
if [ "${user}" != "0" ]; then
echo
echo "$0 must be run as root - you are running as $EUID"
echo
exit 1
fi
echo
echo "About to clean Rancher 2.x custom node"
@gr8linux
gr8linux / kubectl.yml
Created August 22, 2021 05:40 — forked from superseb/kubectl.yml
Rancher 2.0 nfs-provisioner
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: nfs-provisioner
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: nfs-provisioner-runner
# create and name a new mode: "1366x768-0"
/usr/bin/xrandr --newmode "1366x768-0" 75.61 1366 1406 1438 1574 768 771 777 800 -hsync -vsync
# attach the new mode to an output (LVDS-1)
/usr/bin/xrandr --addmode LVDS-1 "1366x768-0"
# turn on the output using the new mode
/usr/bin/xrandr --output LVDS-1 --mode "1366x768-0"
@gr8linux
gr8linux / RSI_and_StochRSI.py
Created April 30, 2020 11:28 — forked from ultragtx/RSI_and_StochRSI.py
Functions that calculate RSI and StochRSI which give the same value as Trading View. I wrote these functions as RSI and StochRSI functions from TA-Lib give different values as TV.
# calculating RSI (gives the same values as TradingView)
# https://stackoverflow.com/questions/20526414/relative-strength-index-in-python-pandas
def RSI(series, period=14):
delta = series.diff().dropna()
ups = delta * 0
downs = ups.copy()
ups[delta > 0] = delta[delta > 0]
downs[delta < 0] = -delta[delta < 0]
ups[ups.index[period-1]] = np.mean( ups[:period] ) #first value is sum of avg gains
@gr8linux
gr8linux / stock.py
Created January 11, 2020 21:57
stock price
from tehran_stocks import Stocks,db,get_asset
import pandas as pd
import matplotlib.pyplot as plt
'''tseStock handle basic operations on TSE data fetch from
tehran-stocks library
usage:
mystock = tseStock('خودرو') # Load IKCO ticker
mystock.plot() # Plot the close price column with pandas.plot function
'''
#TODO Import adjusted data form Tehran stock exchange
@gr8linux
gr8linux / gist:47f1977c039373657842eae2135a15d8
Created July 14, 2019 14:41 — forked from mikhailov/gist:9639593
Nginx S3 Proxy with caching
events {
worker_connections 1024;
}
http {
default_type text/html;
access_log /dev/stdout;
sendfile on;
keepalive_timeout 65;
{
"packages":[
{
"name":"digistump",
"maintainer":"Digistump",
"websiteURL":"http://digistump.com",
"email":"support@digistump.com",
"help":{
"online":"https://digistump.com/board"
},
#!/bin/python3
from multiprocessing import Pool
from urllib.request import Request, urlopen
from urllib.error import URLError, HTTPError
import sys,time
from socket import timeout
def geturls(ufilename):
ulist = []