Skip to content

Instantly share code, notes, and snippets.

View guyroyse's full-sized avatar

Guy Royse guyroyse

View GitHub Profile
import asyncio
import aioredis
async def main():
redis = await aioredis.create_redis('redis://:foobared@localhost:6379/0', encoding='utf-8')
await asyncio.gather(
publish(redis, 1, 'Possible vocalizations east of Makanda'),
publish(redis, 2, 'Sighting near the Columbia River'),
import asyncio
import aioredis
from pprint import pp
async def main():
redis = await aioredis.create_redis('redis://:foobared@localhost:6379/0', encoding='utf-8')
while True:
import asyncio
import aioredis
async def main():
redis = await aioredis.create_redis('redis://:foobared@localhost:6379/0', encoding='utf-8')
await asyncio.gather(
add_to_queue(redis, 'Possible vocalizations east of Makanda'),
add_to_queue(redis, 'Sighting near the Columbia River'),
@guyroyse
guyroyse / redis-ai-and-io-redis.js
Created May 20, 2020 18:34
Using RedisAI from ioredis
let redis = new Redis()
async function classinate(values) {
await redis.call(
'AI.TENSORSET', 'model:in',
'DOUBLE', '1', '10',
'VALUES', ...values)
await redis.call(
package com.guyroyse.blogs.lettucevsjedis;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.Pipeline;
import redis.clients.jedis.Response;
import redis.clients.jedis.Tuple;
import java.util.Set;
import java.util.stream.Collectors;
package com.guyroyse.blogs.lettucevsjedis;
import redis.clients.jedis.Jedis;
public class JedisSetGet {
private static final String YOUR_CONNECTION_STRING = "redis://:foobared@yourserver:6379/0";
public static void main(String[] args) {
package com.guyroyse.blogs.lettucevsjedis;
import io.lettuce.core.RedisClient;
import io.lettuce.core.api.StatefulRedisConnection;
import io.lettuce.core.api.async.RedisAsyncCommands;
public class LettuceAsync {
private static final String YOUR_CONNECTION_STRING = "redis://:foobared@yourserver:6379/0";
package com.guyroyse.blogs.lettucevsjedis;
import io.lettuce.core.RedisClient;
import io.lettuce.core.api.StatefulRedisConnection;
import io.lettuce.core.api.sync.RedisCommands;
public class LettuceSetGet {
private static final String YOUR_CONNECTION_STRING = "redis://:foobared@yourserver:6379/0";
package com.guyroyse.blogs.lettucevsjedis;
import redis.clients.jedis.*;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
public class JedisMultithreaded {
@guyroyse
guyroyse / sample.py
Created December 20, 2019 19:35
The TopK is Out There
from redisbloom.client import Client
client = Client()
client.topkReserve('ufo_words', k=10, width=400,
depth=10, decay=0.9)
# lots of code to get some words...
[client.topkAdd('ufo_words', w) for w in words]