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 / set_special_folder_perm_to_user.sh
Created December 17, 2018 20:40
Set special folder permission to user
#!/bin/bash
sudo -i
setfacl -m u:username:rwx /path/to/folder_or_file
@mhou1981
mhou1981 / delete_undetectable_file.txt
Last active December 13, 2018 17:12
Delete "Item not found" file in Windows
# Run the following command in the Windows Command Prompt (Not Power Shell!!!)
rd /s "\\?\C:\path\to\bad\folder\file
@mhou1981
mhou1981 / enable_disable_chrome_ext.url
Last active December 13, 2018 17:09
White list or Black list Google Chrome Extension Installation DOC
https://www.chromium.org/administrators/policy-list-3#ExtensionInstallBlacklist
@mhou1981
mhou1981 / ubuntu_font.url
Created November 19, 2018 23:58
Ubuntu Font Family
https://design.ubuntu.com/font/
@mhou1981
mhou1981 / apache2_header_security.txt
Created September 26, 2018 06:09
Apache2 Enable Extra Header Security
a2enmod headers
systemctl restart apache2.service
vim /etc/apache2/conf-enabled/security.conf
### add the following:
Header set X-Content-Type-Options: "nosniff"
Header set X-Frame-Options: "sameorigin"
Header unset X-Powered-By
Header set X-XSS-Protection 1;mode=block
Header set Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
@mhou1981
mhou1981 / Testing web page load speed with CURL
Last active August 31, 2018 17:29
Testing web page load time with CURL command
# Tested on CURL v 7.29.0
curl -s -w 'Testing Website Response Time for :%{url_effective}\nRemote IP: %{remote_ip}\nResponse Code: %{response_code}\n\nDNS Lookup Time:\t%{time_namelookup}\nConnect Time:\t\t%{time_connect}\nAppCon Time:\t\t%{time_appconnect}\nRedirect Time:\t\t%{time_redirect}\nPre-transfer Time:\t%{time_pretransfer}\nStart-transfer Time:\t%{time_starttransfer}\n\nTotal Time:\t\t%{time_total}\n' \
-o /dev/null \
https://www.google.com
@mhou1981
mhou1981 / Workaround for VBox Hardening issue
Created July 13, 2018 23:06
Workaround for VirtualBox Hardening issue
My machine was experience virtualbox hardening issue and was only able to stay on the 4.3.12. We have a solution to get around it to run the latest version of Virtual Box. I hope this will help others to get around it.
1. Install the latest version of VirtualBox.
2. Once installed, open Register Editor
3. Nagivate to the following path HKLM\SYSTEM\CurrentControlSet\services\vboxdrv
4. Change Start value to the number 3 (delay start)
5. Reboot your HOST OS
6. Before you start your Virtual Box for the first time after your HOST OS reboot/startup, run the following command line as administrator
sc start vboxdrv
@mhou1981
mhou1981 / pi3b_get_temp.sh
Created July 1, 2018 04:29
PI3B Get temperature
#!/bin/bash
cpuTemp0=$(cat /sys/class/thermal/thermal_zone0/temp)
cpuTemp1=$(($cpuTemp0/1000))
cpuTemp2=$(($cpuTemp0/100))
cpuTempM=$(($cpuTemp2 % $cpuTemp1))
echo CPU temp"="$cpuTemp1"."$cpuTempM"'C"
echo GPU $(/opt/vc/bin/vcgencmd measure_temp)
@mhou1981
mhou1981 / UBuntu_fix_mouse_modifier_vscode.sh
Last active June 3, 2018 20:00
Ubuntu change VSCode multi Cursor problem
gsettings set org.gnome.desktop.wm.preferences mouse-button-modifier "<Super>"
#!/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