Skip to content

Instantly share code, notes, and snippets.

View mhou1981's full-sized avatar
🖥️

Michael mhou1981

🖥️
  • Vancouver, BC, Canada
View GitHub Profile
@mhou1981
mhou1981 / myDateFunction.js
Created October 7, 2017 00:16
JavaScript date function allow to input time difference from now.
function myDate(description) {
var result = new Date();
if (description === undefined || description == "" || description.trim() == "") {
console.info(description + "=[" + result + "]");
return result;
}
var desc = description.trim().toLowerCase();
var section = desc.split(" ");
if (section.length < 2) {
console.info(description + "=[" + result + "]");
@mhou1981
mhou1981 / Server SSH Banner
Created December 13, 2017 20:09
General Server SSH Banner
|-----------------------------------------------------------------|
| This system is for the use of authorized users only. |
| Individuals using this computer system without authority, or in |
| excess of their authority, are subject to having all of their |
| activities on this system monitored and recorded by system |
| personnel. |
| |
| In the course of monitoring individuals improperly using this |
| system, or in the course of system maintenance, the activities |
| of authorized users may also be monitored. |
@mhou1981
mhou1981 / LetsEncrypt_HTTPS_plex.MD
Last active January 1, 2018 06:57 — forked from churro-s/LetsEncrypt_HTTPS_plex.MD
Setup Let's Encrypt certificate for use with Plex Media Server on Ubuntu

Prep

Your ceritifcate files should now be in this directory: /etc/letsencrypt/live/myhostname.no-ip.org/

I also assume your Plex server is port-forwarded to be accessible via port 32400: http://myhostname.no-ip.org:32400

Set up the certificate

Before we begin, we need to generate a PKCS #12 (.pfx) file from the Let's Encrypt certificate files. It's all the Let's Encrypt files archived, and bundled into one file.

Create the PCKS #12 file:

@mhou1981
mhou1981 / check-ssl-expiration-date.sh
Last active January 4, 2018 19:16
Check SSL Certificate Creation and Expiration Date
#!/bin/bash
echo | openssl s_client -servername ${NAME} -connect ${HOST:-localhost}:${PORT:-443} 2>/dev/null | openssl x509 -noout -dates
@mhou1981
mhou1981 / install_go_1_X.sh
Last active November 26, 2018 07:03
Isntall Go Lang 1.10
rm -rf /usr/local/go \
&& curl 'https://dl.google.com/go/go1.11.2.linux-amd64.tar.gz' -o go.tar.gz \
&& tar -zxvf go.tar.gz -C /usr/local \
&& rm -f go.tar.gz
export GOPATH=$HOME/go
@mhou1981
mhou1981 / encode_basic_auth.sh
Created April 24, 2018 17:23
Encode HTTP Basic Auth Credential
username='Test'
password='123'
credentials="$(echo -n "${username}:${password}" | base64)"
echo "Authorization: Basic ${credentials}"
@mhou1981
mhou1981 / USB boot disk preparation reqirement.txt
Last active November 16, 2018 00:42
Things which they don't tell you before creating an USB Start Up Disk
For the Winodws 10 Media Creation Tool, your USB drive requires the following:
- MBR with Primary partion
- at least 8GB
For Linux Installation disk for image on Etcher:
- GPT Format
- at least 4GB
Without the above format, the creation of those bootable USB disk will fail.
@mhou1981
mhou1981 / Fix Putty fuzzy font on Windows 10.txt
Created May 7, 2018 06:07
Fix Putty fuzzy font on Windows 10
In order to fix the fuzzy font issue for Putty on Windows 10.
1. Right mouse click on putty's icon and choose "properties"
2. Click on the "Comaptibility" tab.
3. Select "Override high DPI scaling behaviour Scaling performed by:"
4. Select "System (Enhanced)" in the drop down menu.
5. Click "OK" and reopen Putty.
@mhou1981
mhou1981 / tmux_installation.sh
Created May 7, 2018 22:09
Install TMUX when no root access exists
#!/bin/bash
# Script for installing tmux on systems where you don't have root access.
# tmux will be installed in $HOME/local/bin.
# It's assumed that wget and a C/C++ compiler are installed.
# Modify version number based on the packaged downloaded.
# Packages must be downloaded to the same location as this script.
# exit on error
set -e
#!/bin/bash
# SPDX-License-Identifier: MIT
## Copyright (C) 2009 Przemyslaw Pawelczyk <[email protected]>
##
## This script is licensed under the terms of the MIT license.
## https://opensource.org/licenses/MIT
#
# Lockable script boilerplate