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 | |
# dnspoxy setup for mac | |
sudo networksetup -setdnsservers Wi-Fi 127.0.0.1 | |
sudo python dnsproxy.py -s 192.168.0.1 | |
sudo networksetup -setdnsservers Wi-Fi "Empty" |
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
#!/usr/bin/env python | |
# coding: utf-8 | |
from SocketServer import BaseRequestHandler, ThreadingUDPServer | |
from cStringIO import StringIO | |
import os | |
import socket | |
import struct | |
import time | |
''' |
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 | |
# define the variables | |
INSTANCE_NAME=iap-demo | |
ZONE=europe-west3-c | |
# add firewall rule | |
gcloud compute firewall-rules create allow-echo-ingress-from-iap \ | |
--direction=INGRESS \ | |
--action=allow \ |
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 | |
# define the variables | |
INSTANCE_NAME=iap-demo | |
ZONE=europe-west3-c | |
# connect to the vm | |
gcloud compute ssh $INSTANCE_NAME-vm --tunnel-through-iap --zone $ZONE | |
# download the source file | |
curl https://gist.githubusercontent.com/gabihodoroaga/a64ed25b69939b54a38a30d36affe2c9/raw \ |
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 | |
# enable IAP | |
gcloud services enable iap.googleapis.com | |
# define the variables | |
INSTANCE_NAME=iap-demo | |
ZONE=europe-west3-c | |
# create vm |
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 | |
# setup variables | |
INSTANCE_NAME=iap-demo | |
ZONE=europe-west3-c | |
PROJECT_ID=$(gcloud config get-value project) | |
PROJECT_NUMBER=$(gcloud projects list --filter="$PROJECT_ID" --format="value(PROJECT_NUMBER)") | |
SERVICE_ACCOUNT="[email protected]" | |
# delete firewall rule |
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 socket | |
import sys | |
# Create a TCP/IP socket | |
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
# Connect the socket to the port where the server is listening | |
server_address = ('localhost', 5555) | |
print >>sys.stderr, 'connecting to %s port %s' % server_address | |
sock.connect(server_address) |
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
# simple echo server | |
import socket | |
import sys | |
# Create a TCP/IP socket | |
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
# Bind the socket to the port | |
server_address = ('0.0.0.0', 5555) | |
print >>sys.stderr, 'starting up on %s port %s' % server_address | |
sock.bind(server_address) |
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 -e | |
INSTANCE_NAME=ps-media | |
ZONE=europe-west3-c | |
PRESTASHOP_WEBSITE=http://www.example.com | |
MEDIA_SERVER_NAME=cdn.example.com | |
# download vm-stratup-script.sh | |
curl https://gist.githubusercontent.com/gabihodoroaga/43731b8ad9c63f3fe54913acff5e79c2/raw \ |
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 -e | |
# variable | |
INSTANCE_NAME=ps-media | |
ZONE=europe-west3-c | |
# delete the forwarding-rule aka frontend | |
gcloud -q compute forwarding-rules delete $INSTANCE_NAME-forwarding-rule --global |