- Create your bot with botfather
- Make you bot an admin of your channel
Go to Telegram web and open a channel, get the ID from -[channel id] from hash in the path
https://web.telegram.org/k/#-9999999999999
smartresize() { | |
if [ "$3" == "" ] ; then | |
echo "smartresize inputfile.png 300 outputdir/" | |
else | |
mogrify -path "$3" -filter Triangle -define filter:support=2 -thumbnail "$2" -unsharp 0.25x0.08+8.3+0.045 -dither None -posterize 136 -quality 82 -define jpeg:fancy-upsampling=off -define png:compression-filter=5 -define png:compression-level=9 -define png:compression-strategy=1 -define png:exclude-chunk=all -interlace none -colorspace sRGB "$1" | |
fi | |
} |
#!/bin/bash | |
# Returns interesting information about a HTTP/S call | |
# http://chrisiona.com/post/125309997618/ttfb-a-bash-script-that-returns-interesting | |
curl -so /dev/null \ | |
-w "Response Code: \t\t%{http_code} \ | |
\nName Resolution: \t%{time_namelookup} sec\ | |
\nConnect Time: \t\t%{time_connect} sec\ | |
\nPre Transfer: \t\t%{time_pretransfer} sec\ |
<?php | |
/** | |
* ----------------------------------------------------------------------------------------- | |
* Based on `https://github.com/mecha-cms/mecha-cms/blob/master/system/kernel/converter.php` | |
* ----------------------------------------------------------------------------------------- | |
*/ | |
// HTML Minifier | |
function minify_html($input) { |
/* Based on https://github.com/kenwheeler/slick/issues/187#issuecomment-59123524 */ | |
/* bootstrap hack: fix content width inside hidden tabs */ | |
.tab-content > .tab-pane, | |
.pill-content > .pill-pane { | |
display: block; /* undo display:none */ | |
height: 0; /* height:0 is also invisible */ | |
overflow: hidden; /* no-overflow */ | |
} | |
.tab-content > .active, | |
.pill-content > .active { |
# Install dependencies (if needed) | |
$ yum install -y xorg-x11-fonts-75dpi | |
$ yum install -y xorg-x11-fonts-Type1 | |
$ yum install xz | |
# Get latest version of wkhtmltopdf (replace version number if needed) | |
$ wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz | |
# Untar and move wkhtmltox | |
$ unxz wkhtmltox-0.12.4_linux-generic-amd64.tar.xz |
const waitFor = (ms) => new Promise(r => setTimeout(r, ms)) | |
const asyncForEach = async (array, callback) => { | |
for (let index = 0; index < array.length; index++) { | |
await callback(array[index], index, array) | |
} | |
} | |
const start = async () => { | |
await asyncForEach([1, 2, 3], async (num) => { | |
await waitFor(50) |
<?php | |
function digikalaProduct($PID) { | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, "https://api.digikala.com/v1/product/$PID/"); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.81 Safari/537.36"); | |
$output = curl_exec($ch); | |
curl_close($ch); | |
return $output; |
From Terminal
# install dependencies
brew install autoconf # required by pecl
brew install libzip
# install zip extenion in your selected MAMP PHP version
ls /Applications/MAMP/bin/php/