Skip to content

Instantly share code, notes, and snippets.

View PedroPini's full-sized avatar

Pedro PedroPini

View GitHub Profile
{
"Console log": {
"prefix": "cslog",
"body": [
"console.log('🍎 $1', $3);",
],
"description": "Log with console"
},
"Console log with group": {
"prefix": "csgroup",
@PedroPini
PedroPini / Add_Existing_Project_To_Git.md
Created August 24, 2024 14:47 — forked from alexpchin/Add_Existing_Project_To_Git.md
Add Existing Project To Git Repo

#Adding an existing project to GitHub using the command line

Simple steps to add existing project to Github.

1. Create a new repository on GitHub.

In Terminal, change the current working directory to your local project.

##2. Initialize the local directory as a Git repository.

git init
code --install-extension aaron-bond.better-comments
code --install-extension christian-kohler.path-intellisense
code --install-extension ckolkman.vscode-postgres
code --install-extension curdeveryday.vscode-m5stack-mpy
code --install-extension Dannark.AndroidLauncher
code --install-extension dbaeumer.vscode-eslint
code --install-extension dracula-theme.theme-dracula
code --install-extension dsznajder.es7-react-js-snippets
code --install-extension eg2.vscode-npm-script
code --install-extension EQuimper.react-native-react-redux
--indexes of table
SELECT * FROM pg_indexes WHERE tablename = ''
--list table sizes
SELECT
schema_name,
relname,
pg_size_pretty(table_size) AS size,
table_size
@PedroPini
PedroPini / temp.sql
Created May 6, 2022 06:22
Postgres Check for temporary files size and clear it
SELECT pg_reload_conf();
SELECT temp_files, temp_bytes FROM pg_stat_database db;
SELECT pg_stat_reset();
SHOW config_file;
@PedroPini
PedroPini / linux_partition.sh
Last active May 3, 2022 01:22
Resize Partition on Hyper-V linux VM
#+30%FREE here you can put any number from 0 to 100%
sudo lvextend -l +30%FREE /dev/ubuntu-vg/ubuntu-lv
# use df -h to list your partition and replace it for the one you have
resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv
To Get all extensions
code --list-extensions > extensions.txt
## Create Bash File
#!/usr/bin/env bash
cat extensions.txt | while read extension || [[ -n $extension ]];
do
@PedroPini
PedroPini / Add Serial in existing table with data.txt
Last active February 17, 2022 01:52
Add Serial in existing table with data
SELECT MAX(a) + 1 FROM foo;
CREATE SEQUENCE foo_a_seq START WITH 12345; -- replace 12345 with max above
ALTER TABLE foo ALTER COLUMN a SET DEFAULT nextval('foo_a_seq');
@PedroPini
PedroPini / gist:e668d3b9803de1fee8ded76be7257b35
Created October 7, 2021 00:57
Restart mosquitto in order to new user load into the container
{ docker inspect --format {{.State.Pid}} container_id
kill -SIGHUP ID }
OR
{
docker kill --signal=HUP <container>
}
ssh-keygen -f "~/.ssh/known_hosts" -R "IP_ADDRESS"