Skip to content

Instantly share code, notes, and snippets.

View maguec's full-sized avatar

Chris Mague maguec

View GitHub Profile
#!/usr/bin/python
import sys
import json
f1 = open(sys.argv[1])
f1json = json.load(f1)
for aggregation in ['Sets', 'Gets', 'Totals']:
for stat in ['Count', 'Average Latency', 'Min Latency', 'Max Latency', 'p50.00', 'p99.00', 'p99.90']:
package main
import (
"context"
"crypto/sha256"
"fmt"
"log"
"os"
"strconv"
"time"
@maguec
maguec / gen_port_setup.py
Created March 16, 2021 21:56
Python Script to setup clustered Redis Raft
#!/usr/bin/python3
import csv
import os
NODE_IPS=["192.168.0.1", "192.168.0.2", "192.168.0.3", "192.168.0.4"]
NUM_CPUS=6
RAFT_GROUP=3
TOTAL_SLOTS=16384
@maguec
maguec / GenerateRaftSlots.py
Created January 27, 2021 20:26
Generate Unit files, setup script and CSV fro reference
#!/usr/bin/python3
import csv
import os
NODE_IPS=["192.168.0.1", "192.168.0.2", "192.168.0.3", "192.168.0.4"]
NUM_CPUS=6
RAFT_GROUP=3
TOTAL_SLOTS=16384
@maguec
maguec / showrg.py
Created January 26, 2021 21:24
Show Raft Groups
#! /usr/bin/env python3
# Be sure to run
# pip3 install redis-py-cluster
# pip3 install redis
# for Python Redis Utils
from rediscluster import RedisCluster
startup_nodes = [{"host": "127.0.0.1", "port": "19901"}]
rc = RedisCluster(startup_nodes=startup_nodes, decode_responses=True)
@maguec
maguec / load_wpoi.py
Created January 19, 2021 23:40
Load Data using the batch indexer example
#!/usr/bin/env python3
from redisearch import Client, TextField
import csv
client = Client('WPOI',
host='localhost',
password='',
port=6379
)
package main
import (
b64 "encoding/base64"
"fmt"
"regexp"
"strings"
"time"
)
resource "aws_route53_resolver_endpoint" "re-dns-in-endpoint" {
name = "re-dns-in-endpoint"
direction = "INBOUND"
security_group_ids = [
module.nodes.re-security-group,
]
ip_address {
subnet_id = module.vpc.subnets-public[0]
@maguec
maguec / ip_range_lookup.py
Created December 18, 2019 19:13
Check to see if an IP address is in a range in Redis
#!/usr/bin/python3
import redis, ipaddress
r = redis.Redis(host='localhost', port=6379)
def ip2long(ip):
"""
Convert an IP string to long
"""
import redis
'''
The Cert comes from /etc/opt/redislabs/proxy_cert.pem!
'''
redis_host = '1.2.3.4'
redis_port = 14873
redis_password = 'MyPassword'