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
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
#!/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
#!/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 | |
# 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 | |
# 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
#!/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 | |
# 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
# enable Full Disk Access for temrinal | |
# Go to System Preference -> Security & Privacy -> Full Disk Access | |
# get the list of your backups | |
sudo tmutil listbackups | |
# delete the backup | |
sudo tmutil delete snapshot_path | |
# disable full disk access for terminal |
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
package main | |
import ( | |
"gonum.org/v1/gonum/graph" | |
"gonum.org/v1/gonum/graph/simple" | |
"gonum.org/v1/gonum/graph/traverse" | |
) | |
var ( | |
wdg *LightWeightedGraph |