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
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 | |
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
#!/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
[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/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
#!/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 | |
if [ "$1" == "connect" ] | |
then | |
sudo pon my_tunnel | |
until ip a | grep -q 192.168.55.1; | |
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
#!/bin/bash | |
if [ $# -ne 2 ]; then | |
echo "Usage: $0 \$ssid \$passphrase"; | |
exit 1; | |
fi | |
wifi_device=wlp3s0 | |
ssid=$1 | |
passphrase=$2 |
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
import unittest | |
import feature_extraction | |
class FeatureExtractionTest(unittest.TestCase): | |
def test_extract_opencv_sift(self): | |
imgbytes = bytearray(open("img.jpg", "rb").read()) | |
result = feature_extraction.extract_sift_features_opencv(("testfilename.jpg", imgbytes)) | |
print result |