Skip to content

Instantly share code, notes, and snippets.

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

kmsheng kmsheng

🏠
Working from home
View GitHub Profile
@kmsheng
kmsheng / dollar-signs.sh
Last active August 15, 2018 09:54
All kinds of dollar signs in shell
#!/bin/bash
# Run this script with dollar-sign.sh a b c
echo "process id =" $$
echo
echo "how many arguments = $#"
@kmsheng
kmsheng / README-Template.md
Created July 6, 2018 05:33 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@kmsheng
kmsheng / UC-8112-ME-T-node-red-installation-notes
Last active June 12, 2018 02:13
UC-8112-ME-T node-red installation
sudo su
apt-get update
apt-get install wget
npm install -g --unsafe-perm node-red
# clear Bash's cache of paths to executables
hash -r
swagger: '2.0'
basePath: "/api/v1"
info:
title: VRRP API
description: Provides the VRRP configuration interface
version: 0.1.0
schemes:
- http
- https
produces:
@kmsheng
kmsheng / sanji-vrrp-ui.yaml
Created June 1, 2018 00:53
An example of using swagger yaml for VRRP bundle API
swagger: '2.0'
info:
title: VRRP API
description: Provides the VRRP configuration interface
version: 0.1.0
schemes:
- http
- https
produces:
- application/json
function getPointAlongALine(p0, p1, t) {
return Math.round(((1 - t) * p0 + (t * p1)) * 10) / 10;
}
function reduce(points, t) {
if (points.length === 1) {
return points;
}
@kmsheng
kmsheng / interfaces
Created April 18, 2018 09:12
Ethernet interface example
# The loopback network interface
auto lo
iface lo inet loopback
auto enp4s0
allow-hotplug enp4s0
iface enp4s0 inet dhcp
@kmsheng
kmsheng / hard-coded-interfaces
Last active April 17, 2018 05:52
Hard coded password to /etc/network/interfaces
# The loopback network interface
auto lo
iface lo inet loopback
# Wi-Fi
auto wlp3s0
iface wlp3s0 inet dhcp
wpa-ssid your-ssid
wpa-psk your-password
@kmsheng
kmsheng / interfaces
Last active April 17, 2018 03:34
/etc/network/interfaces for Debian using wpa_supplicant.conf
# The loopback network interface
auto lo
iface lo inet loopback
# Wi-Fi
auto wlp3s0
iface wlp3s0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
@kmsheng
kmsheng / print.sh
Last active April 7, 2018 07:38
example of using shell arguments
#!/bin/bash
print_message() {
echo
echo "arguments are $0 $1 $2"
echo
}
print_message "first" "second"