Skip to content

Instantly share code, notes, and snippets.

@cuixin
cuixin / redis-migrate.sh
Created December 19, 2019 06:24 — forked from nicStuff/redis-migrate.sh
Comfort tool for migrating redis keys among instances. Supports KEYS syntax matching, authentication and TTL
#!/bin/bash
######
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
# TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
# CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
######
@cuixin
cuixin / watch.sh
Created June 17, 2016 02:14 — forked from mikesmullin/watch.sh
watch is a linux bash script to monitor file modification recursively and execute bash commands as changes occur
#!/usr/bin/env bash
# script: watch
# author: Mike Smullin <mike@smullindesign.com>
# license: GPLv3
# description:
# watches the given path for changes
# and executes a given command when changes occur
# usage:
# watch <path> <cmd...>
#
@cuixin
cuixin / client.py
Created April 27, 2016 08:37 — forked from redbo/client.py
import pycurl
import cStringIO
c = pycurl.Curl()
c.setopt(pycurl.VERBOSE, 1)
dummydata = "HI THIS IS SOME DATA"
c.setopt(pycurl.URL, "http://127.0.0.1:9000/noreadbody")
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns
Mutex lock/unlock 25 ns
Main memory reference 100 ns
Compress 1K bytes with Zippy 3,000 ns
Send 2K bytes over 1 Gbps network 20,000 ns
Read 1 MB sequentially from memory 250,000 ns
Round trip within same datacenter 500,000 ns
Disk seek 10,000,000 ns
@cuixin
cuixin / gist:3395915
Created August 19, 2012 16:23 — forked from swannodette/gist:3213107
sudoku.clj
(defn distincto
"s is a sequence of sequence of vars.
ensure that vars in each particular sequence
take on distinct values."
[s]
(if (seq s)
(let [vars (first s)]
(all
(distinctfd vars)
(distincto (next s))))