Skip to content

Instantly share code, notes, and snippets.

View joeyguerra's full-sized avatar
😀
chatting

Joey Guerra joeyguerra

😀
chatting
View GitHub Profile
@joeyguerra
joeyguerra / env-variable-pwsh
Created January 20, 2024 17:21
How to set an environment variable in Windows/PowerShell at the prompt.
$env:DEBUG="hubot:*"
@joeyguerra
joeyguerra / gif-gen.sh
Created January 12, 2024 13:55
create a gif from a Mac OS screen cast
#!/usr/bin/env bash
ffmpeg -i /Users/joeyguerra/Desktop/Screen\ Recording\ 2024-01-10\ at\ 1.37.01 PM.mov -vf "fps=10,scale=640:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 out.gif
@joeyguerra
joeyguerra / ignore-cert.mjs
Created March 20, 2023 16:12
Ignore the cert when making an HTTPS request to a self-signed service.
process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = 0
@joeyguerra
joeyguerra / StreamListener.cs
Created December 3, 2022 18:09
Listen to Redis streams
using StackExchange.Redis;
namespace Shipment;
public class StreamListener
{
private readonly ConnectionMultiplexer _multiplexer;
private string _consumerGroupName;
public StreamListener(ConnectionMultiplexer multiplexer, string consumerGroupName)
using MongoDB.Bson;
public static class BsonDocumentExtentions
{
public static void RemoveNullElements(this BsonDocument documents)
{
RemoveNulls(documents);
}
public static BsonDocument RemoveNulls(BsonDocument document)
{
@joeyguerra
joeyguerra / relative-dir.mjs
Created April 27, 2022 18:20
Reliably get relative path in Node.js
import { fileURLToPath } from 'url'
const dirName = fileURLToPath(import.meta.url).replace('/bin/hubot.mjs', '')
@joeyguerra
joeyguerra / git-serve
Created April 1, 2022 14:59
Allow other people to clone repos from your local machine.
git daemon --verbose --export-all --base-path=. --reuseaddr
@joeyguerra
joeyguerra / gitlab-runner-locally.sh
Created February 18, 2022 03:33
Run gitlab jobs locally for development
gitlab-runner exec docker test-services
@joeyguerra
joeyguerra / Debounce.mjs
Created February 6, 2022 17:52
Debounce in javascript.
import assert from 'assert';
describe('Debounce', ()=>{
it('When called super fast, then should only increment once', done=>{
const debounce = timer => (fn, timeout) => {
clearTimeout(timer);
timer = setTimeout(fn, timeout);
return timer;
};
let timer = null
let actual = 0;
@joeyguerra
joeyguerra / startredis.sh
Last active June 2, 2022 15:15
Run Redis as a docker container
docker run --rm -p 6379:6379 -d --name myredis -v $(pwd):/data redis redis-server --requirepass $(REDIS_PASSWORD) --appendonly yes