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
#!/bin/sh -e
### BEGIN INIT INFO
# Provides: dnscrypt-proxy
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Should-Start: $network $syslog
# Should-Stop: $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
#!/bin/bash
# lock dirs/files
LOCKDIR="/tmp/statsgen-lock"
PIDFILE="${LOCKDIR}/PID"
# exit codes and text
ENO_SUCCESS=0; ETXT[0]="ENO_SUCCESS"
ENO_GENERAL=1; ETXT[1]="ENO_GENERAL"
ENO_LOCKFAIL=2; ETXT[2]="ENO_LOCKFAIL"
#!/bin/python3
from urllib.request import Request, urlopen
from urllib.error import URLError, HTTPError
import sys
def geturls(ufilename):
ulist = []
with open(ufilename,'r') as ufile:
#!/bin/python3
from urllib.request import Request, urlopen
from urllib.error import URLError, HTTPError
import sys,time
import threading
from socket import timeout
def geturls(ufilename):
ulist = []
#!/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 = []
{
"packages":[
{
"name":"digistump",
"maintainer":"Digistump",
"websiteURL":"http://digistump.com",
"email":"support@digistump.com",
"help":{
"online":"https://digistump.com/board"
},
@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;
@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 / 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
# 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"