A common and reliable pattern in service unit files is thus:
NoNewPrivileges=yes
PrivateTmp=yes
PrivateDevices=yes
DevicePolicy=closed
ProtectSystem=strict
Understanding Your Google Cloud Costs | |
# Analyzing Billing Data with BigQuery | |
SELECT * FROM `billing_dataset.enterprise_billing` WHERE Cost > 0 | |
SELECT Line_Item FROM `billing_dataset.enterprise_billing` GROUP BY Line_Item | |
SELECT Line_Item, COUNT(*) as NUM FROM `billing_dataset.enterprise_billing` GROUP BY Line_Item | |
SELECT Project_ID, COUNT(*) as num FROM `billing_dataset.enterprise_billing` GROUP BY Project_ID | |
SELECT SUM(cost) as Cost, Project_Name FROM `billing_dataset.enterprise_billing` GROUP BY Project_Name | |
# Visualizing Billing Data with Data Studio |
# | |
# Wide-open CORS config for nginx | |
# | |
location / { | |
if ($request_method = 'OPTIONS') { | |
add_header 'Access-Control-Allow-Origin' '*'; | |
# |
#!/bin/bash | |
# | |
# Script to create full and incremental backups (for all databases on server) using innobackupex from Percona. | |
# http://www.percona.com/doc/percona-xtrabackup/innobackupex/innobackupex_script.html | |
# | |
# Every time it runs will generate an incremental backup except for the first time (full backup). | |
# FULLBACKUPLIFE variable will define your full backups schedule. | |
# | |
# 2012 Brad Svee modified to try to use xbstream | |
# (C)2012 Atha Kouroussis @ Vurbia Technologies International Inc. |
rsync (Everyone seems to like -z, but it is much slower for me)
#! /bin/bash | |
sudo apt-get update | |
sudo apt-get install -y software-properties-common debconf-utils | |
sudo add-apt-repository -y ppa:webupd8team/java | |
sudo apt-get update | |
sudo echo "oracle-java8-installer shared/accepted-oracle-license-v1-1 select true" | sudo debconf-set-selections | |
sudo apt-get install -y oracle-java8-installer |
#!/bin/bash | |
SENDGRID_API_KEY="" | |
EMAIL_TO="" | |
FROM_EMAIL="" | |
FROM_NAME="" | |
SUBJECT="" | |
bodyHTML="<p>Email body goes here</p>" |
source: http://www.markbrilman.nl/2011/08/howto-convert-a-pfx-to-a-seperate-key-crt-file/ | |
`openssl pkcs12 -in [yourfile.pfx] -nocerts -out [keyfile-encrypted.key]` | |
What this command does is extract the private key from the .pfx file. Once entered you need to type in the importpassword of the .pfx file. This is the password that you used to protect your keypair when you created your .pfx file. If you cannot remember it anymore you can just throw your .pfx file away, cause you won’t be able to import it again, anywhere!. Once you entered the import password OpenSSL requests you to type in another password, twice!. This new password will protect your .key file. | |
Now let’s extract the certificate: | |
`openssl pkcs12 -in [yourfile.pfx] -clcerts -nokeys -out [certificate.crt]` |
#!/bin/bash | |
### VARIABLES ### \ | |
EMAIL="" | |
SERVER=$(hostname) | |
MYSQL_CHECK=$(mysql -e "SHOW VARIABLES LIKE '%version%';" || echo 1) | |
LAST_ERRNO=$(/usr/bin/mysql -e "SHOW SLAVE STATUS\G" | grep "Last_Errno" | awk '{ print $2 }') | |
SECONDS_BEHIND_MASTER=$(/usr/bin/mysql -e "SHOW SLAVE STATUS\G"| grep "Seconds_Behind_Master" | awk '{ print $2 }') | |
IO_IS_RUNNING=$(/usr/bin/mysql -e "SHOW SLAVE STATUS\G" | grep "Slave_IO_Running" | awk '{ print $2 }') | |
SQL_IS_RUNNING=$(/usr/bin/mysql -e "SHOW SLAVE STATUS\G" | grep "Slave_SQL_Running" | awk '{ print $2 }') |
#!/bin/bash | |
## simple redis rdb backup script | |
## usage | |
## rdb-backup.sh rdb.path backup.dir bgsave.wait.seconds | |
SRCPATH=${1:-"/var/lib/redis/"} | |
DESTPATH=${2:-"/opt/redisbackups"} | |
DESTFILE=${3:-"`date '+%Y-%m-%d-%H%M%S'`-redis.rdb.tar.gz"} | |
WAIT=${4:-10} ## default wait for 10 seconds |