Skip to content

Instantly share code, notes, and snippets.

View matiferrigno's full-sized avatar
🤯
Working from home

Matias Emanuel Ferrigno matiferrigno

🤯
Working from home
  • La Plata, Buenos Aires, Argentina
View GitHub Profile
@matiferrigno
matiferrigno / jwt.jq
Last active September 21, 2023 15:56
# ~/.jq/jwt.jq
#
# Ex.
# jq -R 'import "jwt" as jwt; jwt::decode' /tmp/jwt_to_decode
#
# this is a alternative to:
# jq -R 'split(".") | .[0],.[1] | @base64d | fromjson' /tmp/jwt_to_decode
#
# still possible to use an alias for either command but this appears to be more scalable.
@soofaloofa
soofaloofa / Collection+JSON
Last active October 20, 2023 19:21 — forked from soofaloofa-zz/ On choosing a hypermedia type
On choosing a hypermedia type for your API - HAL, JSON-LD, Collection+JSON, SIREN, Oh My!
GET https://api.example.com/player/1234567890
{
"collection": {
"version": "1.0",
"href": "https://api.example.com/player",
"items": [
{
"href": "https://api.example.com/player/1234567890",
"data": [
{"name": "playerId", "value": "1234567890", "prompt": "Identifier"},
@lukeplausin
lukeplausin / bash_aws_jq_cheatsheet.sh
Last active August 29, 2024 20:27
AWS, JQ and bash command cheat sheet. How to query, cut and munge things in JSON generally.
# Count total EBS based storage in AWS
aws ec2 describe-volumes | jq "[.Volumes[].Size] | add"
# Count total EBS storage with a tag filter
aws ec2 describe-volumes --filters "Name=tag:Name,Values=CloudEndure Volume qjenc" | jq "[.Volumes[].Size] | add"
# Describe instances concisely
aws ec2 describe-instances | jq '[.Reservations | .[] | .Instances | .[] | {InstanceId: .InstanceId, State: .State, SubnetId: .SubnetId, VpcId: .VpcId, Name: (.Tags[]|select(.Key=="Name")|.Value)}]'
# Wait until $instance_id is running and then immediately stop it again
aws ec2 wait instance-running --instance-id $instance_id && aws ec2 stop-instances --instance-id $instance_id
# Get 10th instance in the account
@Fusl
Fusl / gist:3a708b8c32c9d5264fa0
Last active October 27, 2024 11:19
Streaming audio output from Linux (Pulseaudio) to Windows
# Windows (receiver) side:
.\ffplay.exe -nodisp -ac 2 -acodec pcm_u8 -ar 48000 -analyzeduration 0 -probesize 32 -f u8 -i udp://0.0.0.0:18181?listen=1
# Linux (transmitter) side:
pactl load-module module-null-sink sink_name=remote
ffmpeg -f pulse -i "remote.monitor" -ac 2 -acodec pcm_u8 -ar 48000 -f u8 "udp://RECEIVER:18181"
pavucontrol # Change the default output to the Null sink or move single applications to this "output" device.