Skip to content

Instantly share code, notes, and snippets.

View joaoluiznaufel's full-sized avatar

João Luiz Castro Naufel joaoluiznaufel

  • João Luiz Castro Naufel
  • Almere - NL
View GitHub Profile
@joaoluiznaufel
joaoluiznaufel / google search
Last active April 21, 2020 06:50
Search engines tips
#check the name of the minions
sudo salt-run manage.up
#update source for salt master.
sudo salt-run git_pillar.update
#check the state first.
sudo salt '*' state.apply test=True
SELECT order_id,product_name,qty
FROM orders
WHERE foo = 'bar'
INTO OUTFILE '/var/lib/mysql-files/orders.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n';
aws s3 sync . s3://<your_bucket> --profile <name_your_profile>
@joaoluiznaufel
joaoluiznaufel / scala - if expressions
Created March 4, 2019 07:17
built-in control structures
var hello = "hello"
if (!hello.isEmpty)
print "is not empty"
var myHello = if (!hello.isEmpty) "is not empty" else "is empty"
@joaoluiznaufel
joaoluiznaufel / mongo cli
Created September 17, 2018 15:18
mongo cli
#insert user:
db.Client.insertOne( {
"id": "5788a5f71b2b6de0148b4567",
"name": "jonho",
"lastname": "dust"
});
#show current table
db
@joaoluiznaufel
joaoluiznaufel / gsutil
Created September 17, 2018 15:16
Gsutil
#send files to buckets
gsutil rsync -d -r <folder path> gs://<name of your bucket>
#change permission bucket
gsutil acl ch -u AllUsers:R gs://yourbucket/**
#!/bin/bash
case "$1" in
"server1") echo "Connecting to server1"
sshpass -p 'your_passwd' ssh <user>@<ip_server>
echo "Connection closed with $1"
;;
"server2") echo "Connecting to server2"
sshpass -p 'your_passwd' ssh <user>@<ip_server>
# Split a big file into multiples fiels
tail -n +2 file_name.csv | split -l 59000 - split_
for file in split_*
do
head -n 1 file_name.csv > tmp_file
cat $file >> tmp_file
mv -f tmp_file $file
done
sed -n '$=' $1