Skip to content

Instantly share code, notes, and snippets.

View zouchao's full-sized avatar
💭
I may be slow to respond.

邹超 zouchao

💭
I may be slow to respond.
View GitHub Profile
@zouchao
zouchao / delete.sh
Created December 15, 2021 03:43
反向删除文件
ls -l | grep -v 'xxxx.file' | xargs rm -rf
@zouchao
zouchao / gist:6a9fc7c250e60de63066d7c3d2370112
Last active December 15, 2021 03:46
获取 Grafana 日志中的某个 Key
content = []
$('.css-jtwxy5-logs-rows').html().replace(/post_id[^\:]*:"(\w+)"/g, function($0, $1) {
content.push($1);
return $0;
})
// 删除某个元素
Array.prototype.remove = function(val) {
var index = this.indexOf(val);
git remote set-url --add --push origin <repo-url-here>
export GOENV_ROOT="$HOME/.goenv"
export PATH="$GOENV_ROOT/bin:$PATH"
eval "$(goenv init -)"
export PATH="$GOROOT/bin:$PATH"
export PATH="$GOPATH/bin:$PATH"
# Generate SHA256 hash
require 'digest'
Digest::SHA256.hexdigest "your_string"
# Generate MD5
require 'digest/md5'
Digest::MD5.hexdigest "your_string"
# Generate UUID
SecureRandom.uuid.split('-').join
@zouchao
zouchao / tp.sh
Last active September 10, 2018 00:49
login rancher docker container
echo '#!/bin/bash
command="docker ps"
for arg in $@; do
command="$command | grep $arg"
done
command="$command | grep -v haproxy | head -1"
if [[ `eval $command` =~ "piledriver" ]]; then
entrance="/bin/sh"
#!/usr/bin/env ruby
require "pathname"
unless ARGV[0]
puts 'Usage: newpost "the post title"'
exit(-1)
end
date_prefix = Time.now.strftime("%Y-%m-%d")
postname = ARGV[0].strip.downcase.gsub(/ /, '-')
function vpn-connect {
/usr/bin/env osascript <<-EOF
tell application "System Events"
tell current location of network preferences
set VPN to service "公司l2tp" -- your VPN name here
if exists VPN then connect VPN
repeat while (current configuration of VPN is not connected)
delay 1
end repeat
end tell
# place this file in ~/.config/terminator/config
[global_config]
title_transmit_bg_color = "#d30102"
focus = system
[keybindings]
reset_clear = <Ctrl>R
new_tab = <Ctrl>T
split_horiz = <Ctrl><Shift>E
split_vert = <Ctrl>E
close_term = <Ctrl><Shift>W