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/sh | |
# | |
# only doing all the sudos as cloud-init doesn't run as root, likely better to use Azure VM Extensions | |
# | |
# $1 is the forwarder, $2 is the vnet IP range | |
# | |
touch /tmp/forwarderSetup_start | |
echo "$@" > /tmp/forwarderSetup_params |
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
def QuickSort(A, start, end): | |
if (start<end): | |
pIndex=Partition(A, start, end) | |
QuickSort(A, start, pIndex-1) | |
QuickSort(A, pIndex+1, end) | |
print(A) | |
def Partition(A, start, end): | |
pivot=A[end] | |
pIndex=start | |
for i in range(start, end): |
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
def Merge(L, R, A): | |
nL=len(L) | |
nR=len(R) | |
i=0 | |
j=0 | |
k=0 | |
while(i<nL and j<nR): | |
if (L[i]<=R[j]): | |
A[k]=L[i] | |
i=i+1 |
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 pandas as pd | |
from pandas import DataFrame | |
from io import StringIO | |
import numpy as np | |
from sklearn.cluster import KMeans | |
df=pd.read_csv('olympics.csv', skiprows=1) | |
def load_data(df): | |
df.rename(columns={'01 !':'Gold','02 !':'Silver','03 !':'Bronze'}, inplace=True) | |
## df.rename(columns={'01 !.1':'Gold','02 !.1':'Silver','03 !.1':'Bronze'}, inplace=True) | |
## df.rename(columns={'01 !.2':'Gold','02 !.2':'Silver','03 !.2':'Bronze'}, inplace=True) |
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 math | |
class complex_number: | |
def __init__(self,real_value,imag_value): | |
try: | |
self.real_value=int(real_value) | |
self.imag_value=int(imag_value) | |
except Exception as e: | |
print(e) | |
def __repr__(self): | |
return "Object of class complex_number" |