Skip to content

Instantly share code, notes, and snippets.

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

Ali Hesari alihesari

🏠
Working from home
View GitHub Profile
@alihesari
alihesari / google-dorks
Created April 3, 2021 06:47 — forked from stevenswafford/google-dorks
Listing of a number of useful Google dorks.
" _ _ "
" _ /|| . . ||\ _ "
" ( } \||D ' ' ' C||/ { % "
" | /\__,=_[_] ' . . ' [_]_=,__/\ |"
" |_\_ |----| |----| _/_|"
" | |/ | | | | \| |"
" | /_ | | | | _\ |"
It is all fun and games until someone gets hacked!
@alihesari
alihesari / listAllEventListeners.js
Created August 22, 2021 08:38 — forked from tkafka/listAllEventListeners.js
List all event listeners in a document
console.table((function listAllEventListeners() {
const allElements = Array.prototype.slice.call(document.querySelectorAll('*'));
allElements.push(document); // we also want document events
const types = [];
for (let ev in window) {
if (/^on/.test(ev)) types[types.length] = ev;
}
let elements = [];
for (let i = 0; i < allElements.length; i++) {
@alihesari
alihesari / regex
Created April 27, 2020 12:49
Mobile regex
(^((00989)|(\+989)|(989)|09|(9[0-4,9][0-9])))
# Mobile range number
901
902
903
904
905
910
911
@alihesari
alihesari / checkout.js
Created February 16, 2020 14:49
Shenase.ir - Checkout
const axios = require('axios');
// Send a POST request
axios({
method: 'post',
url: 'http://shenase.net/api/service/settle/request',
data: {
username: 'ali',
password: 'ali12@34',
card_id: 5,
@alihesari
alihesari / getBillStatus.js
Created February 16, 2020 14:47
shenase.ir - Get bill status
const axios = require('axios');
// Send a POST request
axios({
method: 'post',
url: 'http://shenase.net/api/bills/stateByIds',
data: {
username: 'ali',
password: 'ali12@34',
billId: 5431,
@alihesari
alihesari / createBill.js
Created February 16, 2020 14:17
Shenase.ir - Create Bill
const axios = require('axios');
// Send a POST request
axios({
method: 'post',
url: 'http://shenase.net/api/bills/create',
data: {
username: 'ali',
password: 'ali12@34',
billType: 0,
@alihesari
alihesari / user.js
Created January 1, 2019 15:15 — forked from EtienneR/user.js
XMLHttpRequest RESTful (GET, POST, PUT, DELETE)
// Get all users
var url = "http://localhost:8080/api/v1/users";
var xhr = new XMLHttpRequest()
xhr.open('GET', url, true)
xhr.onload = function () {
var users = JSON.parse(xhr.responseText);
if (xhr.readyState == 4 && xhr.status == "200") {
console.table(users);
} else {
console.error(users);
@alihesari
alihesari / countries.json
Last active September 18, 2018 07:58
JSON List of countries of the world
[
{
"name": "Afghanistan",
"shortName": "AF",
"capital": "Kabul",
"continent": "Asia"
},
{
"name": "Aland Islands",
"shortName": "AX",
@alihesari
alihesari / letsencrypt_2018.md
Created September 2, 2018 21:44 — forked from cecilemuller/letsencrypt_2020.md
How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SSL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SLL rating)


Virtual hosts

Let's say you want to host domains first.com and second.com.

Create folders for their files:

@alihesari
alihesari / app.js
Created August 31, 2018 11:26 — forked from stongo/app.js
Joi validation in a Mongoose model
var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/test');
var db = mongoose.connection;
db.on('error', function() {
return console.error.bind(console, 'connection error: ');
});