Skip to content

Instantly share code, notes, and snippets.

View CatTail's full-sized avatar

Chiyu Zhong CatTail

View GitHub Profile
@CatTail
CatTail / LengauerTarjan.scala
Created July 17, 2024 17:15 — forked from yuzeh/LengauerTarjan.scala
Lengauer-Tarjan Dominator Tree Algorithm
object LengauerTarjan {
// Implement these three yourself
def successors(v: Int): Iterable[Int] = ???
def predecessors(v: Int): Iterable[Int] = ???
def numNodes: Int = ???
// Lifted from "Modern Compiler Implementation in Java", 2nd ed. chapter 19.2
def computeDominatorTree(): Array[Int] = {
var N = 0
@CatTail
CatTail / migrate-redis.py
Last active March 20, 2018 11:34 — forked from thomasst/migrate-redis.py
Migrate Redis data on Amazon ElastiCache
"""
Copies all keys from the source Redis host to the destination Redis host.
Useful to migrate Redis instances where commands like SLAVEOF and MIGRATE are
restricted (e.g. on Amazon ElastiCache).
The script scans through the keyspace of the given database number and uses
a pipeline of DUMP and RESTORE commands to migrate the keys.
Requires Redis 2.8.0 or higher.