Portable solution (tested in linux and macOS):
ps -o args= -p $$ | egrep -m 1 -o '\w{0,5}sh'
where:
"ps -o args=" retrieves the command line arguments
"$$" gives you the current PID
#!/bin/bash | |
# $1 should be en directory name | |
# | |
if [ -z $1 ] | |
then | |
echo "You should specify a directory name" | |
exit 1 | |
else | |
echo "Inititalizing Directory" |
#!/bin/bash | |
# $1 region | |
MYREGION=${1:-eu-west-1} | |
total_instances_output=$(aws ec2 describe-instances --region $MYREGION) | |
total_instances=$(echo "${total_instances_output}" | jq '.Reservations[].Instances[] | [.InstanceId] | @tsv') | |
named_instances=$(echo "$total_instances_output" |jq '.Reservations[].Instances[] | try select (.Tags[].Value = "Key") | [.InstanceId, .PublicIpAddress,.PrivateIpAddress,.State.Name,(.Tags | from_entries | .Name)] | @tsv') |
Portable solution (tested in linux and macOS):
ps -o args= -p $$ | egrep -m 1 -o '\w{0,5}sh'
where:
"ps -o args=" retrieves the command line arguments
"$$" gives you the current PID
# In Mac you can use: | |
# /System/Library/PrivateFrameworks/Apple80211.framework/Resources/airport -I | |
# to find the SSID you are actually connected to | |
# install qrencode | |
brew install qrencode | |
# For WPA2 this will create a wifi.png image that can be used both in Android and iOS devices to auto configure wifi access | |
SSID="your ssid"; SSID_PASS="your password"; qrencode -o wifi.png "WIFI:S:${SSID};T:WPA2;P:${SSID_PASS};;" |
aws ssm get-parameters-by-path \ | |
--path /aws/service/global-infrastructure/services/ --output json | \ | |
grep Name | \ | |
wc -l |
-- Display Lambda Errors Frequency
fields @timestamp, @message
| PARSE @message "[*] *" as loggingType, loggingMessage
| FILTER loggingType = "ERROR"
| sort @timestamp desc
| limit 20
The following helps to analyze the frequency of each key operation.
select * from stl_query where starttime::date='2019-12-05' and userid<>1 order by starttime,query;
and export it to stl_query.csv
import nltk | |
nltk.download('stopwords') | |
nltk.download('punkt') | |
nltk.download('averaged_perceptron_tagger') | |
nltk.download('wordnet') |
If you depend on the Notes App and don't have iCloud sync enabled you may find challenging to migrate notes from one machine to another or just backing it up.
As of today (2019-12) the following approach works (tested on High Sierra to Catalina):
# In the source machine
cd ~/Library/Group\ Containers/group.com.apple.notes
zip NoteStore-backup.zip NoteStore.sqlite*
cd ~/Library/Containers/com.apple.Notes/Data/Library/Notes/
zip NotesV7-backup.zip NotesV7*
{ | |
"metricFilters": [ | |
{ | |
"filterName": "result-2xx", | |
"filterPattern": "{ $.result.req2xx = * }", | |
"metricTransformations": [ | |
{ | |
"metricName": "bombardier-2xx", | |
"metricNamespace": "LogMetrics", | |
"metricValue": "$.result.req2xx", |