Skip to content

Instantly share code, notes, and snippets.

View mayouzi's full-sized avatar

mayor mayouzi

View GitHub Profile
@martinrusev
martinrusev / imap-search
Last active November 4, 2024 12:46
IMAP Search criteria
@mweibel
mweibel / gen-redis-protocol.sh
Last active December 17, 2020 05:14
Redis protocol generator in bash according to http://redis.io/topics/mass-insert. Use e.g. with `./fixture.sh |redis-cli --pipe`. Whitespaces within values are currently not supported.
#!/bin/bash
#
# License: MIT
# Author: Michael Weibel
#
gen_redis_protocol() {
cmd=$1
proto=""
proto+="*"
@abtrout
abtrout / redis-pipe.md
Last active August 11, 2023 03:29
Bash script to prepare Redis commands for mass insertion via `redis-cli --pipe`

Redis supports mass insert via redis-cli --pipe, but commands need to be written in redis protocol. For more details, check out the Redis mass insertion page. This script takes care of converting ordinary redis commands to redis protocol.

#!/usr/bin/env bash

while read CMD; do
  # each command begins with *{number arguments in command}\r\n
  XS=($CMD); printf "*${#XS[@]}\r\n"
  # for each argument, we append ${length}\r\n{argument}\r\n
 for X in $CMD; do printf "\$${#X}\r\n$X\r\n"; done
@ryerh
ryerh / tmux-cheatsheet.markdown
Last active October 30, 2024 08:09 — forked from MohamedAlaa/tmux-cheatsheet.markdown
Tmux 快捷键 & 速查表 & 简明教程

注意:本文内容适用于 Tmux 2.3 及以上的版本,但是绝大部分的特性低版本也都适用,鼠标支持、VI 模式、插件管理在低版本可能会与本文不兼容。

Tmux 快捷键 & 速查表 & 简明教程

启动新会话:

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

恢复会话: