Skip to content

Instantly share code, notes, and snippets.

View king6cong's full-sized avatar

wangcong king6cong

View GitHub Profile
fn di_dynamic() {
struct S;
struct P;
trait T {
fn name(&self);
}
impl T for S {
# sync_bin ssl.sh [email protected]
# brew install gawk first on macOS
mkdir -p ~/log
while true; do
# curl -sS https://api.zjurl.cn/dns 2>&1 >> ~/log/ssl-host; echo >> ~/log/2ssl-host
# curl -sS https://123.58.9.80/dns -k -H 'Host: api.zjurl.cn' 2>&1 >> ~/log/ssl-ip; echo >> ~/log/ssl-ip
curl -sS https://api.zjurl.cn/dns 2>&1 | gawk '{ print strftime("[%Y-%m-%d %H:%M:%S]"), $0 }' 2>&1 >> ~/log/ssl-host-t
curl -sS https://123.58.9.80/dns -k -H 'Host: api.zjurl.cn' 2>&1 | gawk '{ print strftime("[%Y-%m-%d %H:%M:%S]"), $0 }' 2>&1 >> ~/log/ssl-ip-t
sleep 1
done
#!/bin/sh
echo_eval_cmd() {
cmd=$1
echo "======"
echo "$cmd"
echo "======"
eval "$cmd"
}
echo_eval_cmd "curl -s ipinfo.io/ip"
rm -rf ~/Library/Developer/Xcode/DerivedData/*
rm -rf ~/Library/Developer/Xcode/Archives/*
rm -rf ~/Library/Caches/Homebrew/*.gz
rm -rf ~/Library/Caches/Homebrew/*.zip
rm -rf ~/Library/Caches/Homebrew/Cask/*
rm -rf ~/Library/Logs/*
rm -rf '~/Music/iTunes/iTunes Media/Downloads'
rm -rf '~/Music/iTunes/iTunes Media/Mobile Applications'
ls '~/Library/Developer/Xcode/iOS DeviceSupport'
brew cleanup
$crash_path="$home\AppData\Local\Temp\Lark Crashes"
$zip_path="$env:temp\lark"
Write-Host "crash_path: $crash_path, zip_path: $zip_path" -foreground Green
New-Item -Force -Path "$zip_path" -ItemType Directory
Set-Location "$zip_path"
Compress-Archive -Force -Path "$crash_path" -DestinationPath dump.zip
Write-Host "completed. Please upload dump.zip for inspection" -foreground Green
explorer.exe .
#!/bin/sh
set -u
LOG_DIR=/tmp/lark_log
mkdir -p $LOG_DIR
dump_path=`ps aux|grep crash|grep -i lark|grep -v grep|sed "s/.*metrics-dir=\([^-]*\).*/\1/"`
dump_path="$(sed -e 's/[[:space:]]*$//' <<<${dump_path})"
echo '>>> dump path:' $dump_path
cd "$dump_path"
#!/bin/sh
set -u
LOG_DIR=/tmp/lark_log
mkdir -p $LOG_DIR
dump_path=`ps aux|grep crash|grep -i lark|grep -v grep|sed "s/.*metrics-dir=\([^-]*\).*/\1/"`
dump_path="$(sed -e 's/[[:space:]]*$//' <<<${dump_path})"
echo '>>> dump path:' $dump_path
cd "$dump_path"
#!/bin/sh
set -u
LOG_DIR=/tmp/lark_log
mkdir -p $LOG_DIR
log_path=`ps aux|grep crash|grep -i lark|grep -v grep|sed "s/.*metrics-dir=\([^-]*\).*/\1/"`
log_path="$(sed -e 's/[[:space:]]*$//' <<<${log_path})"
echo '>>> log path:' $log_path
cd "$log_path"
fn test_closure_recursive() {
struct Fact<'s> {
f: &'s Fn(&Fact, u32) -> u32,
}
impl<'s> Fact<'s> {
pub fn call(&self, i: u32) -> u32 {
(self.f)(&self, i)
}
}