This focuses on generating the certificates for loading local virtual hosts hosted on your computer, for development only.
Do not use self-signed certificates in production ! For online certificates, use Let's Encrypt instead (tutorial).
| # Simplified version and explanation at: https://stackoverflow.com/a/64439347/12866353 | |
| import os | |
| import ffmpeg | |
| def compress_video(video_full_path, size_upper_bound, two_pass=True, filename_suffix='cps_'): | |
| """ | |
| Compress video file to max-supported size. | |
| :param video_full_path: the video you want to compress. | |
| :param size_upper_bound: Max video size in KB. |
| import numpy as np | |
| from scipy.linalg import eigh | |
| def cca_predict(X, Y, X_new, kx, ky, whitening=False): | |
| """ | |
| Canonical correlation analysis and prediction | |
| Python version of the original R function at: https://github.com/jmhewitt/telefit/blob/master/R/cca.predict.R | |
| :param X: training samples of the predictor with shape M1 x N (M1 variables, N observations) | |
| :param Y: training samples of the predictand with shape M2 x N (M2 variables, N observations) | |
| :param X_new: test samples of the predictor |
This focuses on generating the certificates for loading local virtual hosts hosted on your computer, for development only.
Do not use self-signed certificates in production ! For online certificates, use Let's Encrypt instead (tutorial).
| """An example of how to use tf.Dataset in Keras Model""" | |
| import tensorflow as tf # only work from tensorflow==1.9.0-rc1 and after | |
| _EPOCHS = 5 | |
| _NUM_CLASSES = 10 | |
| _BATCH_SIZE = 128 | |
| def training_pipeline(): | |
| # ############# | |
| # Load Dataset |
| echo "First, you must manually donwload CUDA8 from https://developer.nvidia.com/cuda-downloads" | |
| echo "Ideas taken from https://github.com/BVLC/caffe/wiki/OpenCV-3.2-Installation-Guide-on-Ubuntu-16.04 and http://www.pyimagesearch.com/2016/10/24/ubuntu-16-04-how-to-install-opencv/" | |
| echo "Installing Nvidia drivers" | |
| # Start clean | |
| sudo apt purge nvidia-* | |
| # Add the PPA | |
| sudo add-apt-repository ppa:graphics-drivers/ppa | |
| sudo apt update | |
| sudo apt-get install nvidia-367 |
When running the apt-get update command, the process 'hangs' when checking security.ubuntu.com endpoints.
This is apparantely due to an issue some sites face when trying to connect over IPv6 and whilst it is assumed that this will be
fixed at some point in the future (sooner rather than later judging by the transition to IPv6 by most), the fix below resolves
this issue, allowing the update process to complete successfully.
| /* | |
| This file had now been added to the git repo | |
| https://github.com/darrenjs/openssl_examples | |
| ... which also includes a non blocking client example. | |
| ------------------------------------------------------------------------------- | |
| ssl_server_nonblock.c -- Copyright 2017 Darren Smith -- MIT license |
| #! encoding=UTF-8 | |
| """ | |
| kernel canonical correlation analysis | |
| """ | |
| import numpy as np | |
| from scipy.linalg import svd | |
| from sklearn.metrics.pairwise import pairwise_kernels, euclidean_distances | |
| class KCCA(object): |
When hosting our web applications, we often have one public IP
address (i.e., an IP address visible to the outside world)
using which we want to host multiple web apps. For example, one
may wants to host three different web apps respectively for
example1.com, example2.com, and example1.com/images on
the same machine using a single IP address.
How can we do that? Well, the good news is Internet browsers
This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.
The script is here:
#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"