Skip to content

Instantly share code, notes, and snippets.

@schabluk
schabluk / redis-pipe.md
Created July 16, 2019 11:08 — forked from abtrout/redis-pipe.md
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
@schabluk
schabluk / ConnectedIntlProvider.jsx
Created October 28, 2019 19:59
IntlProvider & Redux StoreProvider
import React from 'react'
import { IntlProvider } from 'react-intl'
import { Provider as StoreProvider, connect } from 'react-redux'
import { createStore } from 'redux'
import { appStore } from './store'
import messages_de from './translations/de.json'
import messages_en from './translations/en.json'
import messages_pl from './translations/pl.json'