Skip to content

Instantly share code, notes, and snippets.

@hirobert
hirobert / empty-rq-failed-queue.py
Created October 12, 2023 18:58
Fix Stuck Jobs in RQ Failed Queue
# If RQ thinks there are failed jobs
# but they do not exist in Redis
# and RQ-Dashboard cannot remove/requeue them
from redis import Redis
from rq import Queue
from rq.registry import FailedJobRegistry
from rq.exceptions import NoSuchJobError
redis_rq = Redis(host=REDIS_SERVER, port=6379, db=1)
<?php
class OAuthException extends Exception
{
// pass
}
class OAuthConsumer
{
public $key;
var OAuth = require('oauth')
// `npm install oauth` to satisfy
// website: https://github.com/ciaranj/node-oauth
var KEY = "<INSERT KEY HERE>"
var SECRET = "<INSERT SECRET HERE>"
var oauth = new OAuth.OAuth(
'http://api.thenounproject.com',
'http://api.thenounproject.com',
// adapted from https://github.com/KaneQc/Noun-Project-API/blob/master/NounProjectAPI.cs
using RestSharp;
using RestSharp.Authenticators;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Request
@hirobert
hirobert / aws-load-balancer-elb-alb-target-group-target-currently-in-use-by-a-listener-or-a-rule.md
Last active August 25, 2022 22:58
aws load balancer (elb/alb) target group - target currently in use by a listener or a rule

This is likely happening because there are still rules associated with the load balancer that are using the target group. Unfortunately there is currently on way in the AWS console to view or edit the rules. Here is another approach:

  1. Install AWS cli: https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html
  2. If you have different profiles, add --profile=name_of_profile on each of the following commands
  3. aws elbv2 describe-load-balancer, get the load balancer arn
  4. aws elbv2 describe-listeners --load-balancer-arn arn:aws:elasticloadbalancing:this_is_the_load_balancer_arn, get listener arn for the listener which you associated with the target group
  5. aws elbv2 describe-rules --listener-arn arn:aws:elasticloadbalancing:this_is_the_listener_arn, get the rule arn which should contain the name of the target group you are looking to remove
  6. aws elbv2 delete-rule --rule-arn arn:aws:elasticloadbalancing:this_is_the_rule_arn
@hirobert
hirobert / ubuntu-docker-credential-desktop-fix.md
Created July 21, 2022 19:19
How to fix Ubuntu docker-credential-desktop error

How to fix Ubuntu docker-credential-desktop error

Errors:

failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0: failed to create LLB definition: rpc error: code = Unknown desc = error getting credentials - err: exec: "docker-credential-desktop": executable file not found in $PATH, out: ``
Error saving credentials: error storing credentials - err: exec: "docker-credential-desktop": executable file not found in $PATH, out: ``
@hirobert
hirobert / .env
Created January 10, 2019 00:45 — forked from schavery/.env
New Relic RQ setup
NEW_RELIC_LICENSE_KEY=6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx5
NEW_RELIC_LOG=stdout
NEW_RELIC_APP_NAME=proj--staging
// taken from https://github.com/erndev/NounSample/blob/master/NounSample/NounApiClient.swift
//
// NounApiClient.swift
// NounSample
//
// Created by ERNESTO GARCIA CARRIL on 9/10/15.
// Copyright © 2015 ernesto. All rights reserved.
//
import AppKit
@hirobert
hirobert / flask_abort_example.py
Created January 13, 2016 20:38
flask abort as json
from flask import abort, make_response, jsonify
abort(make_response(jsonify(message="Message goes here"), 400))
@hirobert
hirobert / NounProjectAPI.cs
Created March 5, 2015 22:50
NounProjectAPI.cs
//taken from https://github.com/KaneQc/Noun-Project-API/blob/master/NounProjectAPI.cs
using RestSharp;
using RestSharp.Authenticators;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Request