Skip to content

Instantly share code, notes, and snippets.

View suchasplus's full-sized avatar

suchasplus suchasplus

  • xmly.work
  • Beijing
View GitHub Profile
@suchasplus
suchasplus / set_rps.sh
Created November 3, 2022 11:15
Receive Packet Steering Set
#!/bin/bash
# Enable RPS (Receive Packet Steering)
cc=$(grep -c processor /proc/cpuinfo)
end=$(((cc-32)/4))
#rpcc=$(head -c $end < /dev/zero | tr '\0' 'f')
#rpcc=$(printf "f%.0s" $(seq $end))
rsfe=32768
count=0
j1=0
j2=0
@suchasplus
suchasplus / MacOS-install-ffmpeg.bash
Created January 21, 2022 06:40
macos install ffmpeg and video convert example
brew tap homebrew-ffmpeg/ffmpeg
brew install homebrew-ffmpeg/ffmpeg/ffmpeg
brew options homebrew-ffmpeg/ffmpeg/ffmpeg
brew install homebrew-ffmpeg/ffmpeg/ffmpeg --with-<option1> --with-<option2> ...
#video eg: https://4ksamples.com/puppies-bath-in-4k/
#20s抽一帧
ffmpeg -i PUPPIES_BATH_IN_4K_Original_H.264_AAC.mp4 -f image2 -vf fps=fps=1/20 puppies_%d.png
@suchasplus
suchasplus / git-team-init-config.sh
Created September 22, 2020 06:01
git team config
#团队协作Git配置推荐 https://sq.163yun.com/blog/article/197477848982818816
git config --global core.eol lf
git config --global core.autocrlf input
git config --global core.safecrlf false
git config --global core.whitespace trailing-space,space-before-tab,-cr-at-eol
git config --global merge.ff only
git config --global tag.sort version:refname
git config --global log.date iso
#使用Tab缩进, 并在修复时将4空格替换为Tab
@suchasplus
suchasplus / semantic-commit-messages.md
Created September 22, 2020 05:52 — forked from joshbuchea/semantic-commit-messages.md
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@suchasplus
suchasplus / openssh reuse.txt
Last active September 22, 2020 05:55
reuse openssh connection
$ cat .ssh/config
Host *
VisualHostKey yes
Compression yes
ServerAliveInterval 60
#PasswordAuthentication no
ControlMaster auto
ControlPersist 4800
ControlPath ~/.ssh/control/%r.%h.%p.sock
@suchasplus
suchasplus / bilibili-combine.sh
Created July 17, 2017 12:28
combine bilibili flvs to one file
cat /dev/null > ff.txt
for i in *.blv; do
seq_num="${i%.blv}" # 分段序列号
if [ "${#seq_num}" -eq 1 ]; then
# 给文件名添 0
mv "$i" "0$seq_num.flv"
else
@suchasplus
suchasplus / cxx11_get_meta.cpp
Created March 16, 2016 14:15
get_class_meta_in_one_line
#define MAKE_PAIR(text) std::pair<std::string, decltype(text)>{#text, text}
template<typename T>
constexpr static inline auto apply(T const & args)
{
return args;
}
template<typename T, typename T1, typename... Args>
constexpr static inline auto apply(T const & t, const T1& first, const Args&... args)
{
@suchasplus
suchasplus / adbplus.sh
Last active January 5, 2016 15:21
adb multi select
#!/bin/bash
# Script adbplus
# Run any command adb provides on all your currently connected devices,
# Or prompt to select one device
showHelp() {
echo "Usage: adbplus [-a] <command>"
echo " -h: show help"
echo " -a: run command on all device"
echo " command: normal adb commands"
@suchasplus
suchasplus / dumpSQL.sh
Created December 28, 2015 06:41
dump sql via tcpdump
#!/bin/bash
tcpdump -i eth0 -s 0 -l -w - dst port 3306 | strings | perl -e '
while(<>) { chomp; next if /^[^ ]+[ ]*$/;
if(/^(SELECT|UPDATE|DELETE|INSERT|SET|COMMIT|ROLLBACK|CREATE|DROP|ALTER|CALL)/i)
{
if (defined $q) { print "$q\n"; }
$q=$_;
} else {
$_ =~ s/^[ \t]+//; $q.=" $_";
@suchasplus
suchasplus / aes.php
Created April 12, 2015 15:46
AES for Android and PHP
<?php
class MCryptAES {
private $iv;
private $key;
private $bit; //Only can use 128, 256
public function __construct($key, $bit = 128, $iv = "") {
if($bit == 256){
$this->key = hash('SHA256', $key, true);
}else{
$this->key = hash('MD5', $key, true);