Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Jim chenwaichung

🎯
Focusing
View GitHub Profile
@chenwaichung
chenwaichung / client.go
Created Jun 14, 2019 — forked from elico/client.go
golang tcp client connection alive check
View client.go
package main
import (
"fmt"
"io"
"net"
"time"
)
func main() {
View check_home_var.sh
#!/bin/bash
if [ -z "$HOME" ]
then
echo "\$HOME is empty"
else
echo "\$HOME is NOT empty"
fi
@chenwaichung
chenwaichung / check_deb_pkg_installed.sh
Created May 9, 2019
use dpkg-query check package is installed?
View check_deb_pkg_installed.sh
#!/bin/bash
pkgs=automake
if dpkg-query -l ${pkgs} >/dev/null 2>&1; then
echo "${pkgs} is installed."
else
echo "${pkgs} not installed."
fi
@chenwaichung
chenwaichung / check.go
Created May 7, 2019 — forked from mattes/check.go
Check if file or directory exists in Golang
View check.go
if _, err := os.Stat("/path/to/whatever"); os.IsNotExist(err) {
// path/to/whatever does not exist
}
if _, err := os.Stat("/path/to/whatever"); !os.IsNotExist(err) {
// path/to/whatever exists
}
@chenwaichung
chenwaichung / coreos-virtualbox.md
Last active Mar 19, 2019 — forked from noonat/coreos-virtualbox.md
Installing CoreOS on VirtualBox
View coreos-virtualbox.md
  • Download and install VirtualBox.
  • Download the CoreOS amd64 ISO
  • Create a new VM in VirtualBox
    • For the OS, Other Linux, 64-bit should be fine
    • Give the VM 1gb of memory, like your physical hardware has.
    • Create a disk of whatever size you want. I made a VMDK file that could expand dynamically up to 8gb.
  • Mount the ISO in the VM
    • Right click on the VM and click settings
    • Go to the storage tab
You can’t perform that action at this time.