This file contains 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
Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0 | |
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0 | |
Start-Service sshd | |
# OPTIONAL but recommended: | |
Set-Service -Name sshd -StartupType 'Automatic' | |
# Confirm the Firewall rule is configured. It should be created automatically by setup. | |
Get-NetFirewallRule -Name *ssh* | |
# There should be a firewall rule named "OpenSSH-Server-In-TCP", which should be enabled | |
# If the firewall does not exist, create one | |
New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22 |
This file contains 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 | |
import numpy as np | |
def calibration_error(y_true, y_prob, n_bins=5, strategy='uniform', return_expected_caliberation_error=True): | |
if strategy == 'quantile': # Determine bin edges by distribution of data | |
quantiles = np.linspace(0, 1, n_bins + 1) | |
bins = np.percentile(y_prob, quantiles * 100) | |
bins[-1] = bins[-1] + 1e-8 | |
elif strategy == 'uniform': | |
bins = np.linspace(0., 1. + 1e-8, n_bins + 1) |
This file contains 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 numpy as np | |
import pandas as pd | |
import statsmodels.api as sm | |
transformations = {'log': np.log, | |
'sqrt': np.sqrt, | |
'sqr': lambda x: np.power(x, 2), | |
'cube': lambda x: np.power(x, 3), | |
'cubert': lambda x: np.power(x, -3), | |
'original': lambda x: x} |
This file contains 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 | |
import numpy as np | |
def closest_node(node, nodes): | |
nodes = np.asarray(nodes) | |
dist_2 = np.sum((nodes - node)**2, axis=1) | |
return np.argmin(dist_2) | |
This file contains 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
from bs4 import BeautifulSoup | |
import pandas as pd | |
soup = BeautifulSoup(open('00001.xml'), 'xml') | |
objs = soup.find_all('object') | |
data = [] | |
for obj in objs: | |
x = [x.get_text() for x in obj.find_all('x')] | |
y = [y.get_text() for y in obj.find_all('y')] | |
name = obj.find('name').get_text() |
This file contains 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
# please install shapely first by `pip install Shapely` | |
from shapely.geometry import Point | |
from shapely.geometry.polygon import Polygon | |
point = Point(0.5, 0.5) | |
polygon = Polygon([(0, 0), (0, 1), (1, 1), (1, 0)]) | |
# this return a bool | |
print(polygon.contains(point)) |
This file contains 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 datetime | |
cf_history = [('CF_B_HST_MONTH_24', 'CF_B_HST_OS_AMOUNT_24', 'CF_B_HST_AC_DPD_24'), | |
('CF_B_HST_MONTH_23', 'CF_B_HST_OS_AMOUNT_23', 'CF_B_HST_AC_DPD_23'), | |
('CF_B_HST_MONTH_22', 'CF_B_HST_OS_AMOUNT_22', 'CF_B_HST_AC_DPD_22'), | |
('CF_B_HST_MONTH_21', 'CF_B_HST_OS_AMOUNT_21', 'CF_B_HST_AC_DPD_21'), | |
('CF_B_HST_MONTH_20', 'CF_B_HST_OS_AMOUNT_20', 'CF_B_HST_AC_DPD_20'), | |
('CF_B_HST_MONTH_19', 'CF_B_HST_OS_AMOUNT_19', 'CF_B_HST_AC_DPD_19'), | |
('CF_B_HST_MONTH_18', 'CF_B_HST_OS_AMOUNT_18', 'CF_B_HST_AC_DPD_18'), | |
('CF_B_HST_MONTH_17', 'CF_B_HST_OS_AMOUNT_17', 'CF_B_HST_AC_DPD_17'), |
This file contains 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 re | |
def get_buckets(statuses): | |
status_bucket = [] | |
for status in statuses: | |
dpd = re.search('(\d+) (or above )?day', status, re.IGNORECASE) | |
if dpd: | |
dpd = int(dpd.groups()[0]) | |
if dpd <= 30: | |
status_bucket.append('SMA-0') | |
elif dpd <= 60: |
This file contains 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
# %matplotlib inline | |
import numpy as np | |
import cv2 as cv | |
from matplotlib import pyplot as plt | |
img = cv.imread('Sample/Sample.tif') | |
edges = cv.Canny(img,100,200) | |
plt.figure(figsize=(30, 25)) | |
# plt.subplot(121),plt.imshow(img,cmap = 'gray') | |
# plt.title('Original Image'), plt.xticks([]), plt.yticks([]) |
This file contains 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 time | |
from fuzzywuzzy import fuzz | |
from fuzzywuzzy import process | |
from joblib import Parallel, delayed | |
start_time = time.time() | |
texts = ['anirban das', 'chitvan gupta', 'prasad devi', 'devi prasad'] * 40 | |
names = ['anirban das', 'devi prasad'] * 6000 | |
def match_name(params): |
NewerOlder