Skip to content

Instantly share code, notes, and snippets.

@miraculixx
miraculixx / README
Last active October 14, 2024 08:42
Celery worker blocks on rate limited task
Celery worker blocks on rate limited task
=========================================
by github.com/miraculixx
Problem:
If a worker has a rate_limit active on some task, and that task
arrives (is received) more often than the rate limit interval, all
worker processes will block on these task instances and stop
consuming other tasks as soon as the prefetch count has maxed out
@adam-hanna
adam-hanna / systemd-cloudwatch-logs-tutorial.md
Last active November 6, 2024 08:17
Forward systemd service logs to AWS Cloudwatch

Introduction

I often find myself ssh'ing into my servers and checking my systemd service logs with $ journalctl -f -u {name}.service. One day I got tired of this and wanted all of my important logs in once place (Amazon AWS Cloudwatch). To my dismay, there weren't any real good tutorials on how to do so. So, voilà.

Steps

Overall, it's a fairly simple process consisting of the following few steps.

1. Modify the service file

Open the service file with $ sudo vi /lib/systemd/system/{name}.service

Modify the [Service] section:

@somazx
somazx / scraper.js
Last active April 15, 2023 16:45
Humble Bundle Unredeemed Keys Scraper
/*
Purpose: easily obtain a list of your humble bundle games that haven't been redeemed.
Instructions:
1) Log into Humble Bundle as usual.
2) Navigate to https://www.humblebundle.com/home/keys
3) Open browser console and run the following script in the console
Script will dump to console the scraped list of all your unredeemed game keys.
@disintegrator
disintegrator / https-during-dev.macos.sh
Last active October 23, 2024 08:32
Use Caddy, mkcert and dnsmasq to expose your development server over HTTPS
brew install caddy mkcert nss dnsmasq
mkcert -install
mkcert '*.app.test' '*.cdn.test'
# rename the certs and move them under /usr/local/etc/caddy/certs
cat <<EOF > /usr/local/etc/caddy/Caddyfile
*.app.test:443, *.cdn.test:443 {
@ipbastola
ipbastola / jq to filter by value.md
Last active September 3, 2024 14:40
JQ to filter JSON by value

JQ to filter JSON by value

Syntax: cat <filename> | jq -c '.[] | select( .<key> | contains("<value>"))'

Example: To get json record having _id equal 611

cat my.json | jq -c '.[] | select( ._id | contains(611))'

Remember: if JSON value has no double quotes (eg. for numeric) to do not supply in filter i.e. in contains(611)

@mystelynx
mystelynx / zshrc
Last active February 17, 2021 23:41
zgen with prezto
# zgen
export ZGEN_RESET_ON_CHANGE=($HOME/.zshrc)
source $HOME/src/github.com/tarjoilija/zgen/zgen.zsh
if ! zgen saved; then
echo "Creating a zgen save"
zgen prezto editor key-bindings 'emacs'
zgen prezto prompt theme 'sorin'
@denji
denji / http-benchmark.md
Last active October 13, 2024 00:43
HTTP(S) Benchmark Tools / Toolkit for testing/debugging HTTP(S) and restAPI (RESTful)