Skip to content

Instantly share code, notes, and snippets.

View NabiKAZ's full-sized avatar

Nabi KaramAliZadeh NabiKAZ

View GitHub Profile
@SaeedDev94
SaeedDev94 / socks2vpn.sh
Last active April 18, 2024 18:50
Linux tun2socks routing helper
#!/bin/bash
if [ "$EUID" -ne 0 ]; then echo "Please run as root"; exit; fi
GATEWAY=$(ip route | awk '/default/ {print $3}')
INTERFACE=$(ip route | awk '/default/ {print $5}')
RESOLVE_CONF=$(cat /etc/resolv.conf)
SOCKS_SCHEME="socks5"
SOCKS_ADDRESS="127.0.0.1"
@NabiKAZ
NabiKAZ / route.php
Last active September 19, 2023 16:09
For show advanced list of files and directories with sort, date, size, icon type,..., Save bellow content code as `route.php` file, and then run this command: `php -S 0.0.0.0:8080 -t . route.php` And then open `http://localhost:8080/` in the browser.
<?php
//@NabiKAZ
//https://gist.github.com/NabiKAZ/91f716faa89aab747317fe09db694be8
//For show advanced list of files and directories with sort, date, size, icon type,...,
//Save bellow content code as route.php file, and then run this command:
// php -S 0.0.0.0:8080 -t . route.php
//And then open http://localhost:8080/ in the browser.
//////////////////////////////////////////////////////////////////
// This block MUST be at the very top of the page!
@ob_start('ob_gzhandler');
@sohamkamani
sohamkamani / rsa.js
Last active April 7, 2024 21:41
An example of RSA Encryption implemented in Node.js
const crypto = require("crypto")
// The `generateKeyPairSync` method accepts two arguments:
// 1. The type ok keys we want, which in this case is "rsa"
// 2. An object with the properties of the key
const { publicKey, privateKey } = crypto.generateKeyPairSync("rsa", {
// The standard secure default length for RSA keys is 2048 bits
modulusLength: 2048,
})
@carlesloriente
carlesloriente / compile-and-install-glibc_2.18-centos-7.sh
Last active April 22, 2024 03:17
Compile and install GLIBC 2.18 in CentOS 7
# Check gist comments to verify system PATH and or adapt it.
wget https://ftp.gnu.org/gnu/glibc/glibc-2.18.tar.gz
tar zxvf glibc-2.18.tar.gz
cd glibc-2.18
mkdir build
cd build
../configure --prefix=/opt/glibc-2.18
make -j4
sudo make install
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/glibc-2.18/lib
@avivace
avivace / telegramRestore.md
Last active May 3, 2024 15:15
Restore deleted Telegram messages from groups

Restore deleted Telegram messages, medias and files from groups

There's not telegram API method for this, we need to call MTProto methods to retrieve messages from the "Recent Actions" (Admin Log) since deleted messages (and medias) gets moved there for 48 hours before the permanent deletion.

from telethon import TelegramClient, events, sync
from telethon.tl.types import InputChannel, PeerChannel
@WesThorburn
WesThorburn / client.js
Created May 14, 2018 22:47
Sending binary messages between client and server using uWS
var socket = new WebSocket("ws://localhost:3000");
socket.binaryType = "arraybuffer";
socket.onopen = function(){
var arrayBufferMessage = stringToArrayBuffer("Test message from client");
socket.send(arrayBufferMessage);
};
socket.onmessage = function(e){
console.log(arrayBufferToString(e.data));
@pierrejoubert73
pierrejoubert73 / markdown-details-collapsible.md
Last active May 2, 2024 16:19
How to add a collapsible section in markdown.

How to add a collapsible section in markdown

1. Example

Click me

Heading

  1. Foo
  2. Bar
    • Baz
  • Qux
@cmer
cmer / haproxy.cfg
Last active April 15, 2024 09:54
Simple, no bullshit TCP port forwarding using HAProxy
listen l1
bind 0.0.0.0:443
mode tcp
timeout connect 4000
timeout client 180000
timeout server 180000
server srv1 host.example.com:9443
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active May 7, 2024 11:19
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@marcosnakamine
marcosnakamine / index.php
Created April 10, 2017 18:21
PHP - Google Invisible reCAPTCHA example
<html>
<head>
<title>reCAPTCHA demo: Simple page</title>
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
<script>
function onSubmit(token) {
document.getElementById("demo-form").submit();
}
</script>
</head>