Skip to content

Instantly share code, notes, and snippets.

⌨️
keyboard shredding

Miguel Mota miguelmota

⌨️
keyboard shredding
Block or report user

Report or block miguelmota

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@miguelmota
miguelmota / matches.go
Created Aug 20, 2019
Golang find string sub groups match using regex
View matches.go
package main
import (
"fmt"
"regexp"
)
func main() {
regex := regexp.MustCompile(`^([0-9]+)|([a-z]+)$`)
matches := regex.FindAllString("100mb", -1)
View ssh_using_password.sh
ssh -o PreferredAuthentications=password -o PubkeyAuthentication=no root@example.com
@miguelmota
miguelmota / mkfile_example.sh
Created Aug 18, 2019
Bash create file of size (mkfile)
View mkfile_example.sh
mkfile 10b 10b.txt
mkfile 10k 10kb.txt
mkfile 10m 10mb.txt
mkfile 1g 1gb.txt
@miguelmota
miguelmota / sed_select_inbetween.sh
Created Aug 15, 2019
Bash sed select content inbetween start and end patterns
View sed_select_inbetween.sh
# don't forget the comma in the middle
sed -n '/some_start_pattern/,/some_send_pattern/p' file.txt
@miguelmota
miguelmota / grep_differences.sh
Created Aug 15, 2019
Bash grep differences between two files
View grep_differences.sh
grep -F -x -v -f file1.txt file2.txt
@miguelmota
miguelmota / sed_differences.sh
Last active Aug 15, 2019
Bash sed differences between two files matching column
View sed_differences.sh
awk 'NR==FNR{c[$2]++;next};c[$2] == 0' file1.txt file2.txt
@miguelmota
miguelmota / postgres_copy_table_differences.sh
Last active Aug 15, 2019
PostgreSQL copy table differences between two databases
View postgres_copy_table_differences.sh
#!/bin/bash
POSTGRES_HOST=your_db_host
POSTGRES_PORT=your_db_port
POSTGRES_USER=your_db_username
POSTGRES_PASS=your_db_password
POSTGRES_DBNAME1=your_db_1_name
POSTGRES_DBNAME2=your_db_2_name
@miguelmota
miguelmota / alacritty.yml
Created Aug 14, 2019
Normal colors for Alacritty terminal
View alacritty.yml
colors:
normal:
black: '0x000000'
red: '0xcc0403'
green: '0x19cb00'
yellow: '0xcecb00'
blue: '0x0d73cc'
magenta: '0x0dcdcd'
cyan: '0x0dcdcd'
white: '0xdddddd'
@miguelmota
miguelmota / is_brave.js
Created Aug 14, 2019
JavaScript check if browser is Brave
View is_brave.js
const res = await (await fetch('https://api.duckduckgo.com/?q=useragent&format=json')).json()
const isBrave = res.Answer.includes('Brave')
console.log(isBrave)
@miguelmota
miguelmota / select_where_time_ago.sql
Created Aug 13, 2019
PostgreSQL select where timestamp is before some time ago
View select_where_time_ago.sql
SELECT * FROM users WHERE created_at >= NOW() - INTERVAL '5 minutes';
You can’t perform that action at this time.