Skip to content

Instantly share code, notes, and snippets.

Avatar

Tran Minh Phuong phuongtailtranminh

  • Hanoi
View GitHub Profile
View gist:3bd64194bcd374c34cc2
###############################
# _ #
# | |_ _ __ ___ _ ___ __ #
# | __| '_ ` _ \| | | \ \/ / #
# | |_| | | | | | |_| |> < #
# \__|_| |_| |_|\__,_/_/\_\ #
# #
###############################
############################################################################
View PumperController.html
<!DOCTYPE html>
<html>
<head>
<title>Arduino Controller</title>
</head>
<body background="http://www.wallpapersonview.com/wallpapers/4/abstract_colorful_textures_widescreen_desktop_background_picture-371.jpg">
<div class="page-header" align="center">
<h1 style="color: white">Pumper Controller</h1>
<h4 id="timer" style="color: white">Running time: 0 (s)</h4>
View Powerline in Putty
Because of 'Meslo for Powerline' font doens't work with Putty.
So we need another patched font to display powerline correctly.
Here are the list:
- DejaVu Sans Mono for Powerline (https://github.com/powerline/fonts/tree/master/DejaVuSansMono)
- Droid Sans Mono for Powerline (https://github.com/powerline/fonts/tree/master/DroidSansMono)
To change font: On main window (Putty Configuration) -> Window -> Apearance -> Font settings -> Change
To test, enter this in the terminal screen: echo "\ue0b0 \u00b1 \ue0a0 \u27a6 \u2718 \u26a1 \u2699"
View Active Windows Photo on Windows 10
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Applications\photoviewer.dll]
[HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell]
[HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\open]
“MuiVerb”=”@photoviewer.dll,-3043”
[HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\open\command]
@=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\
00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,72,00,75,00,\
6e,00,64,00,6c,00,6c,00,33,00,32,00,2e,00,65,00,78,00,65,00,20,00,22,00,25,\
00,50,00,72,00,6f,00,67,00,72,00,61,00,6d,00,46,00,69,00,6c,00,65,00,73,00,\
@phuongtailtranminh
phuongtailtranminh / gist:5fcf99cab4084d2d53bee71dbbfc21c8
Created Aug 24, 2016
Find the maximum number between 2 positive integers (without compare operation, ternary operation)
View gist:5fcf99cab4084d2d53bee71dbbfc21c8
int getMax(int a, int b) {
return ((a + b) + abs(a - b))/2
}
View gist:5fc130605879483cefda633f560e25ad
public class VasgateParser {
private static final Logger log = LoggerFactory.getLogger(VasgateParser.class);
private final String fileName;
private static final int INDEX_OF_PHONE_NUMBER = 0;
public VasgateParser(String fileName) {
this.fileName = fileName;
}
View VirtualBox useful command
# The vboxmanage is located at:
\path\to\virtualbox (example: ..\Oracle\VirtualBox)
# Clone a virtual machine (with Virtual Machine name) to specific folder:
vboxmanage clonevm Funix --basefolder D:\VMWare
@phuongtailtranminh
phuongtailtranminh / Backup and Restore Linux Server
Last active Aug 5, 2019
Backup and Restore Ubuntu Server
View Backup and Restore Linux Server
Backup: sudo tar -cvpzf backup.tar.gz --exclude=/backup.tar.gz --exclude=/boot --one-file-system /
Restore: sudo tar -xvpzf /path/to/tar/file -C / --numeric-owner
View Linux Network Commands
Network Interface Configurator.
- View network settings of an ethernet adapter:
ifconfig eth0
- Display details of all interfaces, including disabled interfaces:
ifconfig -a
- Disable eth0 interface:
ifconfig eth0 down
View Linux&OSX System Commands
Get the system information (OS version): cat /etc/*-release
Lists open files and the corresponding processes: lsof -i :port
Get PID of the process which is running on specific port: netstat -nlp | grep "port"
Get the path of specific PID: ps -fp pid
Get the public ip: curl httpbin.org/ip
Read Realtime log: tailf /path/to/file
Get directory structure: tree /directory
Move to previous directory: cd - (actually it is $OLDPWD environment path)
Copy ssh public key to server: ssh-copy-id user@ip_address
Execute a command repeatedly: watch 'command'