Skip to content

Instantly share code, notes, and snippets.

@olegbuevich
olegbuevich / openssh_rpm_build.sh
Last active December 2, 2022 19:30
Build openssh 8 rpms for centos 6
#!/bin/bash
set -eu
OPENSSH_VERSION="8.0p1"
sudo yum install -y epel-release
sudo yum install -y mock rpm-build
mkdir -p ~/rpmbuild/SOURCES
cd ~/rpmbuild/SOURCES
@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