Skip to content

Instantly share code, notes, and snippets.

@kare
kare / go-unit-test-setup-and-teardown-math_setup_and_teardown_test.go
Created November 22, 2016 17:53
Go unit test setup and teardown math_test.go
package math
import "testing"
func setupTestCase(t *testing.T) func(t *testing.T) {
t.Log("setup test case")
return func(t *testing.T) {
t.Log("teardown test case")
}
}
@justlaputa
justlaputa / docker-clean.py
Last active December 13, 2017 14:17
cleanup unused diffs in docker aufs folder
#!/bin/env python
import os
import json
import hashlib
from functools import reduce
import argparse
import logging
import shutil
DOCKER_DIR = '/var/lib/docker'
@BretFisher
BretFisher / docker-for-mac.md
Last active May 15, 2025 16:59
Getting a Shell in the Docker Desktop Mac VM

2021 Update: Easiest option is Justin's repo and image

Just run this from your Mac terminal and it'll drop you in a container with full permissions on the Docker VM. This also works for Docker for Windows for getting in Moby Linux VM (doesn't work for Windows Containers).

docker run -it --rm --privileged --pid=host justincormack/nsenter1

more info: https://github.com/justincormack/nsenter1


@leodotcloud
leodotcloud / get_image_manifest.sh
Created August 3, 2017 22:33 — forked from alex-bender/get_image_manifest.sh
Docker Registry v2 get manifest and push\pull
#!/bin/bash
#
# Shell scripts for get image manifest from v2 registry
#
# Tested on Debian 8, curl 7.38.0, jq-1.5
#
set -e -u
# Default tag is latest
package main
import (
"net/http"
"net/url"
"runtime"
"strings"
"context"
"bytes"
@ThinGuy
ThinGuy / hp-raid-cfg
Last active November 28, 2023 20:30
Example MaaS Commissioning script to configure HP RAID
#!/bin/bash -x
# --- Start MAAS 1.0 script metadata ---
# name: 00-hp-array-01-config
# type: commissioning
# title: Configure HP Smart Array controllers on HP systems
# description: Configure HP Smart Array Controllers
# script_type: commissioning
# destructive: True
# tags: configure_hba commissioning
# --- End MAAS 1.0 script metadata ---
@superseb
superseb / get_kubeconfig_custom_cluster_rancher2.sh
Last active October 13, 2023 05:51
Get kubeconfig for custom cluster in Rancher 2.x
#!/bin/bash
# Usage: ./get_kubeconfig_custom_cluster_rancher2.sh cluster_name
# Needs to be run on the server running `rancher/rancher` container
# Check if jq exists
command -v jq >/dev/null 2>&1 || { echo "jq is not installed. Exiting." >&2; exit 1; }
# Check if clustername is given
if [ -z "$1" ]; then
echo "Usage: $0 [clustername]"
@ThinGuy
ThinGuy / 00-dell-firmware-01-all.sh
Created February 1, 2019 19:18
Commission Dell 740xd
#!/bin/bash -x
# --- Start MAAS 1.0 script metadata ---
# name: 00-dell-firmware-00-all
# type: commissioning
# title: Firmware Update for PowerEdge R740xd
# description: Dell PowerEdge R740xd Firmware Updates
# script_type: commissioning 
# tags: commissioning update_firmware
# for_hardware: mainboard_product:00WGD1
# may_reboot: True
# Luke's config for the Zoomer Shell
# Enable colors and change prompt:
autoload -U colors && colors
PS1="%B%{$fg[red]%}[%{$fg[yellow]%}%n%{$fg[green]%}@%{$fg[blue]%}%M %{$fg[magenta]%}%~%{$fg[red]%}]%{$reset_color%}$%b "
# History in cache directory:
HISTSIZE=10000
SAVEHIST=10000
HISTFILE=~/.cache/zsh/history
package main
import (
"net/http"
"net/url"
"runtime"
"strings"
"context"
"bytes"