Skip to content

Instantly share code, notes, and snippets.

View ueaner's full-sized avatar

ueaner ueaner

  • Beijing, China
View GitHub Profile
@ueaner
ueaner / exa-wrapper.sh
Created April 20, 2021 17:47 — forked from eggbean/eza-wrapper.sh
Wrapper script for exa to give it nearly identical switches and appearance to ls. Also automatically adds --git switch when in a git repository.
#!/bin/bash
## Change following to '0' for output to be like ls and '1' for exa defaults
# Don't list implied . and .. by default with -a
dot=1
# Show human readable file sizes by default
hru=1
# Don't show group column
fgp=0
# Don't show hardlinks column
@ueaner
ueaner / tcpdump.txt
Last active January 31, 2020 23:43 — forked from gstark/tcpdump.txt
Use tcpdump to monitor mysql
Use tcpdump to monitor mysql
# Capture the packets
sudo tcpdump -i eth0 port 3306 -s 65535 -x -n -q -tttt > tcpdump.out
# analyze all the requests from a given host
pt-query-digest --type=tcpdump --filter '($event->{host} || $event->{ip} || "") =~ m/192.168.248.64/' tcpdump.out
# 直接使用 tcpdump 打印相关SQL文本
sudo tcpdump -i any -nn -s 0 -l -w - host 192.168.56.102 and tcp port 3306 | strings
@ueaner
ueaner / # python3 - 2017-12-23_17-00-57.txt
Created December 26, 2017 15:33
python3 on macOS 10.13.2 - Homebrew build logs
Homebrew build logs for python3 on macOS 10.13.2
Build date: 2017-12-23 17:00:57
@ueaner
ueaner / update-tags.md
Created July 10, 2017 14:39 — forked from alexrqs/update-tags.md
Update github tags with new commits
Create a branch with the tag
	git branch {tagname}-branch {tagname}
	git checkout {tagname}-branch
Include the fix manually if it's just a change ....
	git add .
	git ci -m "Fix included" # or cherry-pick the commit, whatever is easier
	git cherry-pick {num_commit}
@ueaner
ueaner / Untitled-1
Created April 25, 2017 08:06
vscode-gist-test
ssss
@ueaner
ueaner / test.retry.php
Created April 4, 2017 18:28 — forked from mudge/test.retry.php
A retry function for PHP.
<?php
require_once dirname(__FILE__) . '/../lib/simpletest/autorun.php';
function retry($f, $delay = 10, $retries = 3)
{
try {
return $f();
} catch (Exception $e) {
if ($retries > 0) {
sleep($delay);
@ueaner
ueaner / authcode
Created December 5, 2016 03:46 — forked from sarices/authcode
Discuz 加密函数
// $string: 明文 或 密文
// $operation:DECODE表示解密,其它表示加密
// $key: 密匙
// $expiry:密文有效期
function authcode($string, $operation = 'DECODE', $key = '', $expiry = 0) {
// 动态密匙长度,相同的明文会生成不同密文就是依靠动态密匙
$ckey_length = 4;
// 密匙
$key = md5($key ? $key : $GLOBALS['discuz_auth_key']);
package counter
import "io"
type Counter struct {
w io.Writer
c int
}
func New(w io.Writer) (h *Counter) {
@ueaner
ueaner / gist:128839820ae5f9929c23
Created November 10, 2015 10:52 — forked from fernandoaleman/gist:5083680
How to update VirtualBox Guest Additions with vagrant
# Start the old vagrant
$ vagrant init centos-6.3
$ vagrant up
# You should see a message like:
# [default] The guest additions on this VM do not match the install version of
# VirtualBox! This may cause things such as forwarded ports, shared
# folders, and more to not work properly. If any of those things fail on
# this machine, please update the guest additions and repackage the
# box.