This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##Get cluster info | |
$ kubectl cluster-info | |
##Get nodes | |
$ kubectl get nodes | |
##Get contexts (used for multiple clusters) | |
$ kubectl config get-contexts | |
##Change contexts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#get the account | |
gcloud config get-value account | |
#list your projects | |
gcloud projects list | |
#set the project | |
gcloud config set project <project name> | |
# set account to use |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#login at google cloud | |
gcloud auth login | |
#list all the accounts | |
gcloud auth list | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#get all the compute instances | |
gcloud compute instances list | |
#start a ssh connection | |
gcloud compute ssh mongo --zone us-west1-b | |
#using scp to send files recursive | |
gcloud compute scp ~/path/file <instance name>:/path/file --zone us-west1-b --recurse | |
#create ssh tunnel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sed -n '$=' $1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#insert user: | |
db.Client.insertOne( { | |
"id": "5788a5f71b2b6de0148b4567", | |
"name": "jonho", | |
"lastname": "dust" | |
}); | |
#show current table | |
db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var hello = "hello" | |
if (!hello.isEmpty) | |
print "is not empty" | |
var myHello = if (!hello.isEmpty) "is not empty" else "is empty" |
OlderNewer