Skip to content

Instantly share code, notes, and snippets.

@miffa
miffa / git-tag-delete-local-and-remote.sh
Created January 15, 2021 09:41 — forked from mobilemind/git-tag-delete-local-and-remote.sh
how to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
@miffa
miffa / mysql-sp.md
Created December 11, 2020 02:31 — forked from cbess/mysql-sp.md
mysql stored procedure call from golang

A stored procedure that saves (insert/update) a URL, then returns the id for the record.

Works in Go v1.11.6+ and MySQL 5.7+.

DELIMITER ;;

CREATE DEFINER=`root`@`%` PROCEDURE SaveUrl(
    IN p_url varchar(8200),
    IN p_title text
package main
import (
"fmt"
"io"
"os"
)
var path = "/Users/novalagung/Documents/temp/test.txt"
@miffa
miffa / 1_simple.go
Created April 28, 2019 08:16 — forked from sosedoff/1_simple.go
Golang Custom Struct Tags Example
package main
import (
"fmt"
"reflect"
)
// Name of the struct tag used in examples
const tagName = "validate"
@miffa
miffa / etcd_cluster.sh
Created August 25, 2017 08:04 — forked from jolestar/etcd_cluster.sh
Run etcd cluster by docker with custom network
docker network create etcd --subnet 172.19.0.0/16
docker run -d --name etcd0 --network etcd --ip 172.19.1.10 quay.io/coreos/etcd etcd \
-name etcd0 \
-advertise-client-urls http://172.19.1.10:2379,http://172.19.1.10:4001 \
-listen-client-urls http://0.0.0.0:2379,http://0.0.0.0:4001 \
-initial-advertise-peer-urls http://172.19.1.10:2380 \
-listen-peer-urls http://0.0.0.0:2380 \
-initial-cluster-token etcd-cluster-1 \
-initial-cluster etcd0=http://172.19.1.10:2380,etcd1=http://172.19.1.11:2380,etcd2=http://172.19.1.12:2380 \
@miffa
miffa / tmux-cheatsheet.markdown
Created July 11, 2017 10:08 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@miffa
miffa / tmux-cheatsheet.markdown
Created July 11, 2017 10:06 — forked from ryerh/tmux-cheatsheet.markdown
Tmux 快捷键 & 速查表

Tmux 快捷键 & 速查表

启动新会话:

tmux [new -s 会话名 -n 窗口名]

恢复会话:

tmux at [-t 会话名]
@miffa
miffa / redis-delete-scan.sh
Last active January 8, 2016 08:46 — forked from archugs/redis-delete-scan.sh
Shell script to delete redis keys matching a pattern using SCAN iterator
:<<HAHA
[root@ip-10-3-10-20 data]# a=$(redis-cli -h 10.3.8.194 -p 6379 scan 294912)
[root@ip-10-3-10-20 data]# echo $a
3047424 6ac9551b504e9411f1e91ad6c933d72c_AQ_0 b61378029c19176ed003b5f1cf89f369_2_GM_0 52a252487027566c6b3e493c105f89a1_AQ_0 399728d38da6563cf3f1dc3959b27e47_NG_0 825c3ba283b7a91586ba8aa462523b73_1_GM_0 76136ad4c3cda6c5e71275ec4a71f6c3_NG_0 60382f172ea6b97e073f997a74d0d2cc_7_GM_0 d909f605055688396031fd1728c863aa_NG_0 ea4ba3285737fe7901fc6fbb1e5b3819_5_GM_0 53688e0be50bf825d190e261ada1f84d_4_GM_0
HAHA
#!/bin/sh
[ "$#" -eq 1 ] || { echo "ERROR:1 argument required, $# provided"; exit 1; }
cursor=-1
http://d.stavrovski.net/blog/post/how-to-install-and-setup-oracle-java-jdk-in-centos-6
# rpm
wget --no-cookies \
--no-check-certificate \
--header "Cookie: oraclelicense=accept-securebackup-cookie" \
"http://download.oracle.com/otn-pub/java/jdk/7u55-b13/jdk-7u55-linux-x64.rpm" \
-O jdk-7-linux-x64.rpm
# ubuntu