Skip to content

Instantly share code, notes, and snippets.

V2ray Tunnels
install v2ray
sudo apt install speedtest-cli
apt-get update -y && apt-get upgrade -y
sudo rm /var/lib/apt/lists/lock
sudo rm /var/cache/apt/archives/lock
@mortezae
mortezae / promisify-http.js
Created February 15, 2023 19:40 — forked from krnlde/promisify-http.js
util.promisify.custom and http.get example
const http = require('http');
const {promisify} = require('util');
http.get[promisify.custom] = function getAsync(options) {
return new Promise((resolve, reject) => {
http.get(options, (response) => {
response.end = new Promise((resolve) => response.on('end', resolve));
resolve(response);
}).on('error', reject);
});
@mortezae
mortezae / FarsiType
Created September 11, 2022 04:02 — forked from behrad/FarsiType
FarsiType Javascript Plugin
/*
FarsiType
Version: 1.3.6
http://www.farsitype.ir
This script developed to ease typing Farsi (Persian) in web forms where there is no Farsi Keyboard installed on a PC.
Works with Internet Explorer, FireFox, Opera and Chrome.
For more information and getting the using manual please visit the script website (http://www.farsitype.ir).
Copyright 2002-2011 Kaveh Ahmadi (http://www.kavehahmadi.com, email: me@kavehahmadi.com).
@mortezae
mortezae / React.md
Created April 28, 2020 22:21 — forked from taniarascia/React.md
React notes

React Notes

  • A React component can only return one parent element.
return <h1>Hello</h1><p>World</p>            // error
return <div><h1>Hello</h1><p>World</p></div> // okay 
  • JavaScript expressions can be interpolated in JSX with {}
@mortezae
mortezae / nginx.conf
Created February 24, 2020 17:43 — forked from igortik/nginx.conf
Nginx optimized configuration with DDoS mitigation
user nginx;
# one(1) worker or equal the number of _real_ cpu cores. 4=4 core cpu
worker_processes 4;
# renice workers to reduce priority compared to system processes for
# machine health. worst case nginx will get ~25% system resources at nice=15
worker_priority -5;
@mortezae
mortezae / ddos.conf
Created February 24, 2020 12:35 — forked from mattia-beta/ddos.conf
IPtables DDoS Protection for VPS
### 1: Drop invalid packets ###
/sbin/iptables -t mangle -A PREROUTING -m conntrack --ctstate INVALID -j DROP
### 2: Drop TCP packets that are new and are not SYN ###
/sbin/iptables -t mangle -A PREROUTING -p tcp ! --syn -m conntrack --ctstate NEW -j DROP
### 3: Drop SYN packets with suspicious MSS value ###
/sbin/iptables -t mangle -A PREROUTING -p tcp -m conntrack --ctstate NEW -m tcpmss ! --mss 536:65535 -j DROP
### 4: Block packets with bogus TCP flags ###
@mortezae
mortezae / cancelPromise.md
Created February 17, 2020 13:08 — forked from pygy/cancelPromise.md
You can already cancel ES6 Promises

The gist: by having a Promise adopt the state of a forever pending one, you can suspend its then handlers chain.

Promise.pending = Promise.race.bind(Promise, [])

let cancel

new Promise(function(fulfill, reject) {
  cancel = function() {fulfill(Promise.pending())}
  setTimeout(fulfill, 1000, 5)
@mortezae
mortezae / _xmacroplay.md
Created November 15, 2019 20:00 — forked from rg3915/_xmacroplay.md
xmacroplay usage example.

#xmacroplay

Exemplo de uso do xmacroplay.

Usage:

sudo apt-get install xmacro
sudo apt-get install vim
wget --output-document=xmacroexample.sh https://goo.gl/Xt9KkU