Skip to content

Instantly share code, notes, and snippets.

View ma7555's full-sized avatar
🏠
Working from home

ma7555 ma7555

🏠
Working from home
View GitHub Profile
@ma7555
ma7555 / sstp_server.md
Last active June 27, 2024 03:20
SSTP VPN Server with Docker on Ubuntu VPS

On the VPS:

  • Create a 10 year certificate. The "Common Name" (CN) must be the static IP of the instance.
    openssl req  -nodes -new -x509 -keyout key.pem -out cert.pem -days 3650
  • Run the SoftEther docker with either of the following:
    1. A Single User, SSTP only. Not updated recently (7 years ago at the time of creating the gist)
    sudo docker run -d --cap-add NET_ADMIN -e SSTP_ENABLED=1 -e USERNAME=YOUR_VPN_USERNAME -e PASSWORD=YOU_VPN_PASS -e SERVER_PWD=YOUR_SERVER_PASS -e CERT="$(cat cert.pem)" -e KEY="$(cat key.pem)" -p 443:443/tcp fernandezcuesta/softethervpn
@ma7555
ma7555 / openvino_centos_build.sh
Created November 9, 2022 13:25
Build OpenVINO on Centos 7.9
#!/bin/sh
# Copyright (C) 2018-2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
############################################################
# Function #
############################################################
Help()
{
@ma7555
ma7555 / parallel_pandas.py
Created June 3, 2021 09:36
Parallel Pandas Apply
import pandas as pd
import time
from multiprocessing import Pool, cpu_count, freeze_support
import numpy as np
import os
def timeit(method):
def timed(*args, **kw):
ts = time.time()
result = method(*args, **kw)
@ma7555
ma7555 / stratified_train_test_val_split.py
Last active June 19, 2020 14:02
Create stratified train/test/validation splits for a pandas dataframe
import pandas as pd
from sklearn.model_selection import StratifiedShuffleSplit
def get_stf_ttv(data, targets, train_size=0.8, random_state=555):
'''
Used to get stratified train/test/validation splits
Test and validation splits are equal, if train_size is set to 0.8,
the remaining 0.2 will be split between test and validation
resulting in 80% train, 10% test, 10% validation
@ma7555
ma7555 / get_cats.py
Last active November 24, 2019 21:05
import petpy
import pandas as pd
import urllib.request
import time
import os
from ast import literal_eval
from tqdm import tqdm_notebook
def downloader(filename, image_url):
full_file_name = filename + '.jpg'
@ma7555
ma7555 / create_sha256_signature.py
Created March 21, 2019 10:10 — forked from gauravvjn/create_sha256_signature.py
Create HMAC SHA256 signature/encryption/encode
"""
https://gist.github.com/Azadehkhojandi/50eaae4cf20b21faef186f2c8ee97873
"""
import hmac
import hashlib
import binascii
def create_sha256_signature(key, message):