Skip to content

Instantly share code, notes, and snippets.

Working from home

Shayan Memari ShayMe21

Working from home
View GitHub Profile
ShayMe21 / gist:a514e4030411015612e687db0e994e9b
Last active March 4, 2022 00:49
lolicode/C# OpenBullet2 - random UA selector
View gist:a514e4030411015612e687db0e994e9b
string[] UAs = {
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36",
"Opera/9.80 (Windows NT 6.1; WOW64) Presto/2.12.388 Version/12.18",
"Mozilla/5.0 (X11; Linux i686; rv:78.0) Gecko/20100101 Firefox/78.0",
"Opera/9.80 (Linux armv7l) Presto/2.12.407 Version/12.51 , D50u-D1-UHD/V1.5.16-UHD (Vizio, D50u-D1, Wireless)",
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36",
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Firefox/78.0",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0]"
ShayMe21 / MyViewController.cs
Created July 31, 2018 07:27
Xamarin with Auth0 and TouchID Authentication
View MyViewController.cs
using System;
using UIKit;
using Auth0.OidcClient;
using System.Text;
using LocalAuthentication;
using Foundation;
using Xamarin.Auth;
ShayMe21 / update_user_name_samlp_rule.js
Created July 12, 2019 04:45
Auth0 Update SAML IdP user's name
View update_user_name_samlp_rule.js
function (user, context, callback) {
var ManagementClient = require('auth0@2.9.1').ManagementClient;
let saml_name = `${user.first_name} ${user.last_name}`;
console.log(saml_name); = saml_name;
var management = new ManagementClient({
ShayMe21 / auth0.service.ts
Created May 16, 2019 22:10
Auth0 Angular2+ ParseHash with error handling of rules
View auth0.service.ts
public handleAuthentication(): void {
this.auth0.parseHash({}, (err, authResult) => {
if (authResult && authResult.accessToken && authResult.idToken) {
this.auth0.client.userInfo(authResult.accessToken, function (err, user) {
localStorage.setItem("user_id", user.sub);
ShayMe21 / get_user.js
Created March 27, 2019 12:25
Auth0 SQL Server Custom DB Get User script
View get_user.js
function getByEmail(email, callback) {
//this example uses the "tedious" library
//more info here:
const sqlserver = require('tedious@1.11.0');
const Connection = sqlserver.Connection;
const Request = sqlserver.Request;
const TYPES = sqlserver.TYPES;
var user_profile = [];
ShayMe21 / auth0js-parseHash-angular.ts
Created March 11, 2019 22:51
Auth0.js ParseHash detect state missing error check and redirect. This can happen when a user bookmarks the hosted login page or keeps the page open for 30minutes+
View auth0js-parseHash-angular.ts
public handleAuthentication(): void {
}, (err, authResult) => {
if (authResult && authResult.accessToken && authResult.idToken) {
this.auth0.client.userInfo(authResult.accessToken, function (err, user) {
localStorage.setItem("user_id", user.sub);
View Auth0 .Net Core Get management API Token.cs
public async void getapi2token(){
var AuthAPI = new AuthenticationApiClient(new Uri(""));
var api2Response = await AuthAPI.GetTokenAsync(new ClientCredentialsTokenRequest
ClientId = "43BKVc57RgIiVJrbM8gRDIBQgofdByYe",
ClientSecret = "xxx",
View auth0-api2-python.jpy
import requests
import json
ShayMe21 / hlp.html
Created October 1, 2018 01:07
View hlp.html
<!DOCTYPE html>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Sign In with Auth0</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<button id="lock_button">Lock</button>