Skip to content

Instantly share code, notes, and snippets.

View hedzr's full-sized avatar
🎯
Focusing

hz hedzr

🎯
Focusing
View GitHub Profile
@hedzr
hedzr / Mac下开机自动连接ssh -D.txt
Created February 19, 2016 05:39 — forked from iksky/Mac下开机自动连接ssh -D.txt
Mac下开机自动连接ssh -D
首先我们来生成公钥文件。Terminal下面输入
ssh-keygen -t rsa
之后在Terminal的提示里按回车。直到生成id_rsa.pub文件,生成的id_rsa.pub文件在 ~/.ssh下面。Terminal下面输入
cd ~/.ssh
cp id_rsa.pub authorized_keys
上面第一句的意思是进入~/.ssh文件夹,第二句是复制id_rsa.pub为authorized_keys文件。
@hedzr
hedzr / setup-android-build-tools.sh
Last active April 30, 2019 21:21
setup-android-build-tools-on-ubuntu-16-or-heigher
#!/bin/bash
setup-android-build-tools () {
sudo apt install -y openjdk-8-jdk
mkdir -P ~/Android/sdk
pushd ~/Android/sdk >/dev/null
[ -d tools ] || {
[ -f sdk-tools-linux-3859397.zip ] || wget -c https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip
[ -d tools ] || [ -f sdk-tools-linux-3859397.zip ] && unzip sdk-tools-linux-3859397.zip
https://press.one/p/v?s=4f4e8d9e3ef52a3af3324d1b6650798f99f72a035a9540ac4203d6c044208b920dffa74f09a761803365b6c1f0b27f15f8e4f64fd22adf0fc8a227792a56010601&h=70c1880b5a2db11f79b4778340b304b52dd8307abee071c3d5ff5719fa37b21a&a=4db0ad2a817858508cee91e7ca898f70bb4b05b1&f=P1&v=3
@hedzr
hedzr / docker-fn-save-load.sh
Last active August 27, 2022 00:26
This script give a set of commands to save/load [all] docker containers as/from .tgz file(s).
#!/usr/bin/env bash
# # docker-fn series
# docker-fn-save-load.sh:
#
# This script give a set of commands to save/load [all] docker containers as/from .tgz file(s).
# > While you would plan to reset docker disk image file.
#
# Author: Hedzr Yeh
# LICENSE: MIT
@hedzr
hedzr / git-submodule-rm
Last active August 30, 2019 09:14
Bundle to remove a git submodule
#!/bin/bash
# AUTHOR: Hedzr Yeh
# LICENSE: MIT
# PREREQUISITES:
# 1. install ini-op tool:
# i. via `go install`
# `go get github.com/hedzr/ini-op`
# ii. download ini-op bianry release and put the unzipped executable file into a location which is $PATH searchable

the logos in my jodl projects

function docker-rmi-none() {
for i in `docker-images-none-cids`; do
echo $i
#local cid=$(docker-cid "$i")
#[ "$cid" != "" ] &&
local pid=$(docker-pid "$i" 2>/dev/null)
[ "$pid" != "" ] && echo "-------- Cleaning the stopped container: $i, $pid" && docker rm -f $pid
[ "$i" != "" ] && echo "-------- Erasing the container: $i, $pid" && docker rmi -f $i
done
}
@hedzr
hedzr / vmware_run.md
Last active September 1, 2022 06:29
Bash/Zsh script for running VM in headless mode (VMWare Fusion or VMWare)

Paste the content into your .zshrc or .bashrc, and relogin.

# $ vmware_run help
# Usage:
#  vmware_run <VM-name> <start|stop|suspend|reset|pause|unpause>
#  vmware_run <VM-name> <start_with_gui|start-with-gui>
#
# Examples:
#  vmware_run start u20.local.new
@hedzr
hedzr / 97.A-Typesetter-independent-TROFF.ps
Created December 25, 2021 04:33
A Typesetter-independent TROFF
%!PS
%%Version: 3.3.1
%%DocumentFonts: (atend)
%%Pages: (atend)
%%EndComments
%
% Version 3.3.1 prologue for troff files.
%
/#copies 1 store
__vms_reg() {
# hash -d | grep -qE '^vhost.ub20a=' || hash -d vhost.ub20a="$HOME/work/ops.work/ub20a.local"
hash -d | grep -qE '^vhost.hello=' || hash -d vhost.hello="$HOME/hack/work/hello-1-cxx"
# Or modified tabbed entries in ~/.vagrant.vhosts. A sample entry is:
# ub20a $HOME/work/ops.work/ub20a.local
if [ -f "$HOME/.vagrant.vhosts" ]; then
local name1 name2
while IFS=$'\t' read -r name1 name2; do
if [[ "$name1" != "" ]]; then