Skip to content

Instantly share code, notes, and snippets.

View gabrielbarros's full-sized avatar

Gabriel Barros gabrielbarros

  • Rio de Janeiro, Brasil
  • 07:25 (UTC -03:00)
View GitHub Profile
@gabrielbarros
gabrielbarros / reverse-string.php
Last active March 11, 2024 17:08
Reverse a string correctly in PHP considering bytes, code points and graphemes
<?php
// For ASCII only
$hello = 'Hello';
$revStrBytes1 = '';
for ($i = strlen($hello) - 1; $i >= 0; $i--) {
$revStrBytes1 .= $hello[$i];
}
// Alternative to the code above
@gabrielbarros
gabrielbarros / mail-servers.txt
Last active March 7, 2024 20:57
Mail servers (SMTP, IMAP and POP) for Gmail and Microsoft (Hotmail, Outlook)
Gmail
IMAP: imap.gmail.com:993 (SSL/TLS)
POP: pop.gmail.com:995 (SSL/TLS)
SMTP: smtp.gmail.com:587 (STARTTLS)
Microsoft (Hotmail, Outlook)
IMAP: outlook.office365.com:993 (SSL/TLS)
POP: outlook.office365.com:995 (SSL/TLS)
SMTP: smtp-mail.outlook.com:587 (STARTTLS)
@gabrielbarros
gabrielbarros / install-rclone
Created March 6, 2024 20:09
Install and update rclone
#!/usr/bin/env bash
set -euo pipefail
echo 'Installing rclone...'
wget https://downloads.rclone.org/rclone-current-linux-amd64.zip
unzip rclone-current-linux-amd64.zip
sudo mv rclone-*-linux-amd64/rclone /usr/local/bin
@gabrielbarros
gabrielbarros / install-mkcert
Created March 6, 2024 20:09
Install and update mkcert
#!/usr/bin/env bash
set -euo pipefail
echo 'Installing mkcert...'
curl -s https://api.github.com/repos/FiloSottile/mkcert/releases/latest | \
jq -r '.assets[].browser_download_url' | grep -F linux-amd64 | wget -i -
sudo mv mkcert-* /usr/local/bin/mkcert
@gabrielbarros
gabrielbarros / install-diff-so-fancy
Created March 6, 2024 20:09
Install and update diff-so-fancy
#!/usr/bin/env bash
set -euo pipefail
echo 'Installing diff-so-fancy...'
curl -s https://api.github.com/repos/so-fancy/diff-so-fancy/releases/latest | \
jq -r '.assets[].browser_download_url' | wget -i -
sudo mv diff-so-fancy /usr/local/bin
@gabrielbarros
gabrielbarros / install-symfony
Created March 6, 2024 20:08
Install and update Symfony CLI
#!/usr/bin/env bash
set -euo pipefail
echo 'Installing symfony-cli...'
wget https://github.com/symfony-cli/symfony-cli/releases/latest/download/symfony-cli_linux_amd64.tar.gz
tar -xvzf symfony-cli_linux_amd64.tar.gz symfony
sudo mv symfony /usr/local/bin
@gabrielbarros
gabrielbarros / install-composer
Created March 6, 2024 20:06
Install and update Composer
#!/usr/bin/env bash
set -euo pipefail
echo 'Installing Composer...'
if [ -f /usr/bin/php ]; then
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
else
@gabrielbarros
gabrielbarros / unicode-box-drawing.txt
Last active April 2, 2024 15:04
Box drawing - Draw a table with unicode characters
UNICODE BOX DRAWING CHARACTERS
┌ ─ ─ ─ ┬ ─ ─ ─ ┐ ╭ ─ ─ ─ ┬ ─ ─ ─ ╮
│ a │ b │ │ a │ b │
├ ─ ─ ─ ┼ ─ ─ ─ ┤ ├ ─ ─ ─ ┼ ─ ─ ─ ┤
│ c │ d │ │ c │ d │
@gabrielbarros
gabrielbarros / unicode-intervals.txt
Last active June 25, 2025 21:50
Unicode code point intervals (UTF-8, UTF-16BE and UTF-32BE)
UNICODE
• Basic plan: 63,488 valid code points
┌───────────────────┬─────────┬─────────┬─────────┬───────────────────┐
│ Interval │ UTF-8 │ UTF-16 │ UTF-32 │ Code points │
├───────────────────┼─────────┼─────────┼─────────┼───────────────────┤
│ U+0000..U+007F │ 1 byte │ 2 bytes │ 4 bytes │ 128 (ASCII) │
├───────────────────┼─────────┼─────────┼─────────┼───────────────────┤
│ U+0080..U+07FF │ 2 bytes │ 2 bytes │ 4 bytes │ 1,920 │
├───────────────────┼─────────┼─────────┼─────────┼───────────────────┤
@gabrielbarros
gabrielbarros / unicode-invisible-chars.txt
Last active June 17, 2025 22:14
Unicode Invisible characters
U+0009 CHARACTER TABULATION
U+000A LINE FEED
U+000B LINE TABULATION
U+000C FORM FEED
U+000D CARRIAGE RETURN
U+0020 SPACE
U+00A0 NO-BREAK SPACE
U+00AD SOFT HYPHEN
U+034F COMBINING GRAPHEME JOINER
U+061C ARABIC LETTER MARK