Skip to content

Instantly share code, notes, and snippets.

View NabiKAZ's full-sized avatar

Nabi KaramAliZadeh NabiKAZ

View GitHub Profile
@krakjoe
krakjoe / pthreads-helper
Last active August 20, 2019 21:05
pthreads-helper to download/install php+pthreads isolated
#!/bin/bash
# This should be a path that the user executing the script can read and write
PHP_PATH=/opt/php-ts
# This should be a sensible version of PHP
PHP_VERSION=7.0.0
# This should be a sensible mirror for your location
PHP_MIRROR=uk1.php.net
# This should be a released version of pthreads
PHP_PTHREADS=3.1.5
# This should be set to 0 if you do not want to remove build directories
@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));
@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>
@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');
@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
@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"
@bennylope
bennylope / ffmpeg-watermark.md
Created April 22, 2016 23:17 — forked from webkader/ffmpeg-watermark.md
FFmpeg add a watermark to video

How to Add a Watermark to Video

FFMPEG filters provide a powerful way to programmatically enhance or alter videos, and it’s fairly simple to add a watermark to a video using the overlay filter. The easiest way to install ffmpeg is to download a pre-built binary for your specific platform. Then you don’t have to worry about including and installing all the right dependencies and codecs you will be using.

Once you have ffmpeg installed, adding a watermark is as easy as passing your existing source through an overlay filter like so:

ffmpeg -i test.mp4 -i watermark.png -filter_complex "overlay=10:10" test1.mp4

Basically, we’re passing in the original video, and an overlay image as inputs, then passing it through the filter, and saving the output as test1.mp4.

@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
@mayconbordin
mayconbordin / progress_bar.php
Created June 2, 2012 23:55
PHP CLI progress bar in 5 lines of code
<?php
function progress_bar($done, $total, $info="", $width=50) {
$perc = round(($done * 100) / $total);
$bar = round(($width * $perc) / 100);
return sprintf("%s%%[%s>%s]%s\r", $perc, str_repeat("=", $bar), str_repeat(" ", $width-$bar), $info);
}
@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