Skip to content

Instantly share code, notes, and snippets.

View mathcale's full-sized avatar
💃

Matheus Calegaro mathcale

💃
View GitHub Profile
@mathcale
mathcale / catppuccin-mocha-slack-new-ui.md
Created April 30, 2024 19:48
Catppuccin Mocha colors for Slack's new UI
  1. Click your profile picture in the bottom left.
  2. Go to Preferences → Themes
  3. Click on "Import theme" and paste the following string:
#1E1E2E,#CBA6F7,#A6E3A1,#FAB387

Source

@mathcale
mathcale / restart-dock.sh
Created April 9, 2024 17:22
Restart macOS's Dock safely
#!/bin/bash
launchctl stop com.apple.Dock.agent
launchctl start com.apple.Dock.agent
@mathcale
mathcale / clear-node-modules.sh
Last active June 23, 2020 17:41
Recursively checks and removes "node_modules" directories from projects.
#!/bin/bash
SUMMARY=$(find . -name "node_modules" -type d -prune -print | xargs du -chs)
if [ -z "$SUMMARY" ]; then
echo "👍 No node_modules directories found!"
exit 0
fi
echo -e "👇 The following projects has a \"node_modules\" directory:\n"
@mathcale
mathcale / list-port.sh
Last active November 4, 2022 13:04
Lists which processes are using a specific port on macOS
# Change $PORT with the port you want to scan
sudo lsof -i -P | grep LISTEN | grep :$PORT
#!/bin/bash
function die {
declare MSG="$@"
echo "$0: Error: $MSG">&2
exit 1
}
@mathcale
mathcale / README.md
Last active June 4, 2020 01:27
My Ubuntu 18/Linux Mint 19 Setup
@mathcale
mathcale / estados.html
Last active July 24, 2018 13:15
Estados brasileiros em HTML, PHP e JS (separados)
<select id="uf" name="uf">
<option value="AC">Acre</option>
<option value="AL">Alagoas</option>
<option value="AP">Amapá</option>
<option value="AM">Amazonas</option>
<option value="BA">Bahia</option>
<option value="CE">Ceará</option>
<option value="DF">Distrito Federal</option>
<option value="ES">Espirito Santo</option>
<option value="GO">Goiás</option>
@mathcale
mathcale / SendMessage.php
Last active January 13, 2017 17:04
Send email with PHP, jQuery, Validate and customized with Bootstrap
<?php
$name = filter_var($_POST["name"], FILTER_SANITIZE_STRING);
$email = filter_var($_POST["email"], FILTER_SANITIZE_EMAIL);
$message = filter_var($_POST["message"], FILTER_SANITIZE_STRING);
$to = "contact@yourcompany.com";
$subject = "YourCompany - Contact Message";
$msg = '<h3 style="font-family: sans-serif">Sender\'s info:</h3>
// Conexoes
#define TRIGGER_PIN 12
#define ECHO_PIN 13
#define IN1 4
#define IN2 5
#define IN3 6
#define IN4 7
// Configs
int distanciaMaxima = 15;
@mathcale
mathcale / passgen.php
Last active May 9, 2016 19:46
Simple password generator with PHP
<?php
// Setting up the timezone
date_default_timezone_set("America/Sao_Paulo");
// Grabbing the date and time
$now = date("YmdHis");
// Converting the date into a MD5 hash, reducing it to 8 characters, "shuffling" it and type-casting as string (why not?!)
$password = (string) str_shuffle(substr(md5($now), 0, 8));