Skip to content

Instantly share code, notes, and snippets.

View ashkanRmk's full-sized avatar
:octocat:
Doing what makes me happy!

Ashkan Rahmani ashkanRmk

:octocat:
Doing what makes me happy!
View GitHub Profile
**EU Server scripts**
apt-get update -y && apt-get upgrade -y
apt install curl -y
bash <(curl -Ls https://raw.githubusercontent.com/vaxilu/x-ui/master/install.sh)
--------------------------------------------------------------
**Iran Server scripts**
@ashkanRmk
ashkanRmk / youtube_contest.py
Last active January 9, 2021 09:21
this snippet code choose 3 random winner of your specific YouTube video. implementation flow on : https://youtu.be/x3GqBhm3XuA
import requests as rq
import random
video_id = "[YOUR_VIDEO_ID]"
token = "[YOUR_TOKEN]"
url = "https://www.googleapis.com/youtube/v3/commentThreads"
response = rq.get(url, params={
'part' : 'replies,snippet',
'maxResults' : '100',
@ashkanRmk
ashkanRmk / randomStr.py
Created January 3, 2019 18:17
small script make random unique string with define length
import uuid
size = 10000000 #number of uniqe strings
length = 5 #length of generated strings
filename = "result.txt" #name of result file
temp = []
print("START...")
with open(filename, 'w') as f:
while size > 0:
function base64url_encode($plainText)
{
$base64 = base64_encode($plainText);
$base64 = trim($base64, "=");
$base64url = strtr($base64, '+/', '-_');
return ($base64url);
}
$random = bin2hex(openssl_random_pseudo_bytes(32));
$verifier = base64url_encode(pack('H*', $random));
https://oauth.payping.io/connect/authorize?
scope=SCOPES&
response_type=code&
client_id=YOUR_CLIENT_ID&
code_challenge=CODE_CHALLENGE&
code_challenge_method=S256&
redirect_uri=https://YOUR_CALLBACK_URL
@ashkanRmk
ashkanRmk / cURL
Last active September 15, 2018 13:23
curl --request POST \
--url 'https://oauth.payping.io/connect/token' \
--header 'content-type: application/json' \
--data '{"grant_type":"authorization_code","client_id": "YOUR_CLIENT_ID","client_secret" : "YOUR_CLIENT_SECRET" "code_verifier": "YOUR_GENERATED_CODE_VERIFIER","code": "YOUR_AUTHORIZATION_CODE","redirect_uri": "YOUR_REDIRECT_URL", }'
curl --request POST \
--url 'https://YOUR_AUTH0_DOMAIN/oauth/token' \
--header 'content-type: application/json' \
--data '{"grant_type":"authorization_code","client_id": "YOUR_CLIENT_ID","code_verifier": "YOUR_GENERATED_CODE_VERIFIER","code": "YOUR_AUTHORIZATION_CODE","redirect_uri": "com.myclientapp://myclientapp.com/callback", }'
https://stageacc.payping.io/connect/authorize?
audience=API_AUDIENCE&
scope=SCOPE&
response_type=code&
client_id=YOUR_CLIENT_ID&
code_challenge=CODE_CHALLENGE&
code_challenge_method=S256&
redirect_uri=https://YOUR_APP/callback
function sha256(buffer) {
return crypto.createHash('sha256').update(buffer).digest();
}
var challenge = base64URLEncode(sha256(verifier));
function base64URLEncode(str) {
return str.toString('base64')
.replace(/\+/g, '-')
.replace(/\//g, '_')
.replace(/=/g, '');
}
var verifier = base64URLEncode(crypto.randomBytes(32));