Skip to content

Instantly share code, notes, and snippets.

# Gist is at https://gist.github.com/nerdalert/9dcb14265a3aea336f40
#
# Macvlan/Ipvlan Manual Driver Tests
# -Bash script form at: https://github.com/nerdalert/dotfiles/blob/master/ipvlan-macvlan-it.sh
############################################################################################
# Macvlan IPv4 802.1q VLAN Tagged Bridge Mode Tests
#
### Network w/o explicit mode to default to -o macvlan_mode=bridge VLAN ID:33
docker network create -d macvlan \
--subnet=192.168.33.0/24 \
@baonq243
baonq243 / go-os-arch.md
Created December 3, 2020 10:24 — forked from asukakenji/0-go-os-arch.md
Go (Golang) GOOS and GOARCH

Go (Golang) GOOS and GOARCH

All of the following information is based on go version go1.14.7 darwin/amd64.

A list of valid GOOS values

(Bold = supported by go out of the box, ie. without the help of a C compiler, etc.)

  • aix
  • android
@baonq243
baonq243 / reset_evaluation_2020_1_mac_os.sh
Created November 18, 2020 13:23
reset evaluation pycharm 2019 - 2020
cd ~/Library/Preferences/
ls | grep 'jetbrains' | xargs rm
cd ~/Library/Application\ Support/JetBrains/PyCharm2020.1/
rm eval/*.key
rm options/other.xml
cd ~/Library/Preferences
plutil -convert xml1 com.apple.java.util.prefs.plist
sed -i'' -e '/evlsprt/d' com.apple.java.util.prefs.plist
plutil -convert binary1 com.apple.java.util.prefs.plist
@baonq243
baonq243 / diskstats.py
Created May 13, 2020 08:42 — forked from mmalone/diskstats.py
python diskstats parser
def diskstats():
file_path = '/proc/diskstats'
# http://lxr.osuosl.org/source/Documentation/iostats.txt
columns_disk = ['major_dev_num', 'minor_dev_num', 'device', 'reads', 'reads_merged', 'sectors_read', 'ms_reading', 'writes', 'writes_merged', 'sectors_written', 'ms_writing', 'current_ios', 'ms_doing_io', 'weighted_ms_doing_io']
columns_partition = ['major_dev_num', 'minor_dev_num', 'device', 'reads', 'sectors_read', 'writes', 'sectors_written']
result = {}
for line in (l for l in open(file_path, 'r').xreadlines() if l != ''):
parts = line.split()
@baonq243
baonq243 / human_readable.sh
Created March 27, 2019 02:52 — forked from agunnerson-ibm/human_readable.sh
Bash function to convert bytes to human readable size
# Copyright 2015 Andrew Gunnerson <andrewgunnerson@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@baonq243
baonq243 / bytesToHuman.bash
Created March 27, 2019 02:51 — forked from jpluimers/bytesToHuman.bash
bash script to convert numbers (usually bytes) to IEC or SI human readable format
#!/bin/bash
# bytesToHuman based on https://unix.stackexchange.com/questions/44040/a-standard-tool-to-convert-a-byte-count-into-human-kib-mib-etc-like-du-ls1/259254#259254
# units from wikipedia (note I had to re-order Z and Y):
# - https://en.wikipedia.org/wiki/Binary_prefix
# - https://en.wikipedia.org/wiki/File_size
# - https://en.wikipedia.org/wiki/ISO/IEC_80000#Information_science_and_technology
# test cases from https://www.alteeve.com/w/IEC_and_SI_Size_Notations and https://en.wikipedia.org/wiki/File_size
# 64-bibt checks at https://superuser.com/questions/1030122/what-is-the-maximum-value-of-a-numeric-bash-shell-variable/1030129#1030129
@baonq243
baonq243 / bytesToHR.sh
Created March 25, 2019 08:40 — forked from gnif/bytesToHR.sh
[BASH] Convert bytes to human readable
function bytesToHR()
{
local SIZE=$1
local UNITS="B KiB MiB GiB TiB PiB"
for F in $UNITS; do
local UNIT=$F
test ${SIZE%.*} -lt 1024 && break;
SIZE=$(echo "$SIZE / 1024" | bc -l)
done