This file contains hidden or 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 | |
| machine_type=f1-micro | |
| image=ubuntu-14-04 | |
| gcloud compute instances create shadowsocks-1 \ | |
| --can-ip-forward --image $image --restart-on-failure \ | |
| --zone asia-east1-b --machine-type $machine_type \ | |
| --metadata-from-file startup-script=bin/shadowsocks-startup.sh |
This file contains hidden or 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 | |
| set -xe | |
| imageid=$1 | |
| qemu-img convert -f raw -O qcow2 rbd:images/$imageid $imageid.qcow2 |
This file contains hidden or 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
| [Unit] | |
| Description=Phone Home Reverse SSH Service | |
| ConditionPathExists=|/usr/bin | |
| After=network.target | |
| [Service] | |
| User=sshtunnel | |
| ExecStart=/usr/bin/ssh -NTC -o ServerAliveInterval=60 -o ExitOnForwardFailure=yes -o StrictHostKeyChecking=no -i /home/sshtunnel/.ssh/id_rsa -R 22223:localhost:22 user@remote-ssh-server | |
| # Restart every >2 seconds to avoid StartLimitInterval failure | |
| RestartSec=3 |
This file contains hidden or 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/ash | |
| today=$(date +"%d-%m-%Y") | |
| time=$(date -I'seconds') | |
| echo "Pinging 8.8.8.8 at $time" >> /var/log/ping-check-$today | |
| ping -c 5 8.8.8.8 | grep -E "round-trip|packet loss" >> /var/log/ping-check-$today | |
| # Optionally create a cron job to execute every minute | |
| # Contrab: */1 * * * * /root/ping-check.sh |
This file contains hidden or 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 | |
| NODEID=$1 | |
| SALTMASTER=$2 | |
| echo "deb https://repo.saltstack.com/apt/ubuntu/16.04/amd64/2016.3 xenial main" > /etc/apt/sources.list.d/salt.list | |
| apt-get update | |
| mkdir -p /etc/salt/minion.d/ | |
| cat > /etc/salt/minion.d/minion.conf << EOL |
This file contains hidden or 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
| apiVersion: v1 | |
| kind: Service | |
| metadata: | |
| name: redis-master | |
| labels: | |
| app: redis | |
| tier: backend | |
| role: master | |
| spec: | |
| ports: |
This file contains hidden or 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 | |
| set -xe | |
| while read host; do | |
| echo "Setting correct dhcp network setting for $host" | |
| ip=$(reclass-salt --pillar $host | grep single_address | grep -Eo "([0-9\.]*)$") | |
| ssh $ip << EOF | |
| if ! grep -q "ens2 inet dhcp" /etc/network/interfaces; then | |
| cat << EOT >> /etc/network/interfaces |
This file contains hidden or 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 | |
| BRICK=$1 | |
| setfattr -n trusted.glusterfs.volume-id -v 0x$(grep volume-id /var/lib/glusterd/vols/$BRICK/info | cut -d= -f2 | sed 's/-//g') /srv/glusterfs/$BRICK |
This file contains hidden or 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 | |
| set -x | |
| openstack project create upgrade-demo-1 | |
| openstack project create upgrade-demo-2 | |
| openstack project create upgrade-demo-3 | |
| INPUT=$1 | |
| while read line; do |
This file contains hidden or 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
| function prune_old_rows() { | |
| var ss = SpreadsheetApp.getActiveSpreadsheet(); | |
| var sheet = ss.getSheetByName('Form Submissions'); | |
| var rows = sheet.getDataRange(); | |
| var numRows = rows.getNumRows(); | |
| var values = rows.getValues(); | |
| // assumes that there is a column "Added" as the first column |