Skip to content

Instantly share code, notes, and snippets.

View j-vizcaino's full-sized avatar

Jérôme Vizcaino j-vizcaino

View GitHub Profile
@j-vizcaino
j-vizcaino / gocover.sh
Created June 1, 2022 09:18
Simple script to run Go tests with coverage, and open the pretty result in a browser
» cat ~/bin/gocover
#!/usr/bin/env bash
set -e
coverprofile="cover.out"
pkgs=${@-.}
function _cleanup {
rm -f $coverprofile
@j-vizcaino
j-vizcaino / update-emby-tizen.sh
Created May 26, 2022 10:29
Download and extract Emby Tizen release to a USB stick
#!/usr/bin/env bash
set -euo pipefail
url="https://github.com/MediaBrowser/Emby.Releases/raw/master/tizen/tizen.zip"
usbstick="/dev/disk/by-id/usb-JetFlash_Transcend_8GB_AA6H19F78R2DV2FP-0:0-part1"
tmpdir=$(mktemp -d)
usbdir="$tmpdir/usb"
usbpkg="$usbdir/tizen.zip"
@j-vizcaino
j-vizcaino / command.go
Created May 1, 2021 08:28
Simple external command runner (Go)
import (
"bytes"
"fmt"
"os"
"os/exec"
"strings"
"syscall"
)
type ErrorHandler func(cmdLine string, exitCode int, output string)
@j-vizcaino
j-vizcaino / helm-release-gc
Created January 7, 2021 16:38
Tool to remove old Helm release ConfigMaps
#!/usr/bin/env bash
set -eu
NONE='\033[0m' # default coloring
K='\033[0;30;1m' # black
R='\033[0;31;1m' # red
G='\033[0;32;1m' # green
Y='\033[0;33;1m' # yellow
B='\033[0;34;1m' # blue
@j-vizcaino
j-vizcaino / git-branch-rm-merged
Last active October 12, 2020 13:35
Remove local Git branches that are merged in main branch
#!/usr/bin/env bash
set -eu
active_branch=$(git branch | awk '/^\* / { print $2 }')
case "$active_branch" in
prod|master)
;;
*)
@j-vizcaino
j-vizcaino / k8s-gc
Last active November 3, 2022 13:36
#!/usr/bin/env bash
set -eu
NONE='\033[0m' # default coloring
K='\033[0;30;1m' # black
R='\033[0;31;1m' # red
G='\033[0;32;1m' # green
Y='\033[0;33;1m' # yellow
B='\033[0;34;1m' # blue
@j-vizcaino
j-vizcaino / my-public-ip
Created May 26, 2017 14:14
Determine public IPv4 from command line
dig +short myip.opendns.com @resolver1.opendns.com
@j-vizcaino
j-vizcaino / SAS Hitachi HDD
Last active January 24, 2017 20:51
S.M.A.R.T output examples
smartctl 6.4 2014-10-07 r4002 [x86_64-linux-3.16.0-4-amd64] (local build)
Copyright (C) 2002-14, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF INFORMATION SECTION ===
Vendor: HITACHI
Product: HUC106060CSS600
Revision: A360
Compliance: SPC-4
User Capacity: 600,127,266,816 bytes [600 GB]
Logical block size: 512 bytes