Skip to content

Instantly share code, notes, and snippets.

@fbatiga
fbatiga / node-updater.sh
Created February 2, 2023 09:33
node version updater script
sudo rm /etc/apt/sources.list.d/nodesource.list
sudo curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt install -y nodejs
sudo node -v
@fbatiga
fbatiga / Find all process and delete them
Created January 12, 2023 12:10
Find all process and delete them
kill $(ps aux | grep 'master.js' | awk '{print $2}')
@fbatiga
fbatiga / Update fields by query
Created January 6, 2023 11:55
Update data by elasticsearch
/toocamp_*_dispos_live/_update_by_query
```json
{
"query": {
"exists": {
"field": "raw_data"
}
},
"script": {
@fbatiga
fbatiga / gist:c2d0cc34858e6f560ea90d9e8d814db3
Created November 22, 2022 22:52
Sync folder with exclusion (scp with exclude replacement)
rsync -av -e ssh --exclude='*.log' ~/virt/ destination:/tmp
@fbatiga
fbatiga / .aliases
Last active November 23, 2022 11:44
Aliases for easier shell working
alias y=yarn
alias l='ls -la'
alias rn=react-native
alias egit="git --git-dir=.gitenyo"
alias cgit="git --git-dir=.gitclient"
alias g='git'
alias get='git'
@fbatiga
fbatiga / Slackit
Created November 19, 2019 18:53
Send message to slack
#!/bin/bash
CHANNEL="#devops"
USERNAME="tamea"
EMOJI=":ghost:"
HOOK=<slack hook url>
MSG=$1
PAYLOAD="payload={\"channel\": \"$CHANNEL\", \"username\": \"TAMEA SERVER - $USERNAME\", \"text\": \"$MSG\", \"icon_e$
@fbatiga
fbatiga / git-make-anonymous
Created August 29, 2019 08:26
rewrite history to remove unwanted email adresses
#!/bin/zsh
echo "making commits from $1 anonymous"
export OLD_EMAIL=$1
export CORRECT_NAME="Enyosolutions"
export CORRECT_EMAIL="new@Email.com"
echo $OLD_EMAIL
@fbatiga
fbatiga / server_init.sh
Last active March 31, 2019 08:28
Basic files install
sudo su
sudo apt update
sudo apt install -y nano curl wget nginx letsencrypt fail2ban
sudo apt install mysql-common mysql-server -y
mysql_secure_installation
systemctl start mysql
systemctl enable mysql
@fbatiga
fbatiga / Psql admin
Created March 12, 2019 14:47
Login into Postgresql
sudo -i -u postgres
psql
@fbatiga
fbatiga / Psql admin
Last active March 18, 2019 14:48
Login into Postgresql
sudo -i -u postgres
psql
CREATE DATABASE "db_name";
CREATE USER "your_user" WITH ENCRYPTED PASSWORD 'XXXXXXXX';
GRANT ALL PRIVILEGES ON DATABASE "db_name" TO "your_user";
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO "your_user";
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO "your_user";
GRANT ALL PRIVILEGES ON ALL FUNCTIONS IN SCHEMA public TO "your_user";