Skip to content

Instantly share code, notes, and snippets.

View joshdurbin's full-sized avatar

Josh Durbin joshdurbin

View GitHub Profile
@joshdurbin
joshdurbin / generategcsdata.go
Last active March 13, 2024 15:52
Generate random files in GCS
package main
import (
"cloud.google.com/go/storage"
"context"
"fmt"
"math/rand"
"os"
"os/signal"
"sync"
@joshdurbin
joshdurbin / redis_util.go
Last active June 2, 2023 19:51
Redis content generator and concurrent poller of replicas
package main
import (
"context"
"flag"
"fmt"
"github.com/redis/go-redis/v9"
"golang.org/x/sync/errgroup"
"math/rand"
"net"
Programmatic finished in 687498 ms
Programmatic finished in 1152935 ms
Ran calculations 1000000000 times. Results:
|-----------------------------------|
| Flips | Programmatic | Mathy |
|-----------------------------------|
| 0 | 499999527 | 499991146 |
| 1 | 249993072 | 249998627 |
| 2 | 125001055 | 125011612 |
match (p:person)-[:transact]->(:order)-[:contain]->(:product)<-[:contain]-(:order)-[:contain]->(prd:product) where p.id=294 return distinct prd limit 1
redis graph
https://youtu.be/JNpHba2kRGM
https://youtu.be/aGHALjV6JGc
https://youtu.be/FC4PVQpwhqQ
@joshdurbin
joshdurbin / 1.groovy
Created April 27, 2020 23:32
2020-2-groovy-concurrent-redis-operations-with-jedis
#!/usr/bin/env groovy
@Grapes([
@Grab(group='redis.clients', module='jedis', version='3.2.0'),
@Grab(group='org.slf4j', module='slf4j-nop', version='1.7.30')
])
import redis.clients.jedis.JedisPool
def jedisPool = new JedisPool()
package main
import (
"flag"
"github.com/thoas/go-funk"
"log"
"time"
)
type result struct {
@Grapes([
@Grab(group='org.apache.pdfbox', module='pdfbox', version='2.0.13'),
@Grab(group='org.apache.tika', module='tika-core', version='1.18'),
@Grab(group='me.xdrop', module='fuzzywuzzy', version='1.2.0')
])
import org.apache.pdfbox.pdmodel.PDDocument
import org.apache.pdfbox.text.PDFTextStripper
import org.apache.tika.Tika
import java.util.concurrent.ConcurrentLinkedQueue
from __future__ import division
import sheep
from color import RGB
A = [1, 3, 4, 7, 9, 12, 16, 18, 19, 21, 22, 24, 27, 30, 33, 35, 37, 39, 42]
B = [2, 5, 6, 8, 11, 13, 14, 15, 17, 20, 23, 25, 26, 28, 29, 31, 32, 34, 36, 40, 41, 43]
class Josh(object):
@joshdurbin
joshdurbin / matchFaces
Last active April 19, 2017 20:15
Groovy, Guava, AWS Rekognition SDK, Indexes faces and queries indexes looking for similar faces
#!/usr/bin/env groovy
@Grapes([
@Grab(group='com.amazonaws', module='aws-java-sdk-rekognition', version='1.11.117'),
@Grab(group='com.google.guava', module='guava', version='21.0')
])
import com.amazonaws.auth.AWSCredentials
import com.amazonaws.auth.DefaultAWSCredentialsProviderChain
import com.amazonaws.auth.profile.ProfileCredentialsProvider