Skip to content

Instantly share code, notes, and snippets.

@redraw
redraw / stream.sh
Created July 7, 2023 13:49
streaming mastodon emoji display
curl -sL https://mstdn.jp/api/v1/streaming/public | grep -oE '{.*' --line-buffered | jq --unbuffered -r '.emojis[].url' | xargs -n1 ~/.iterm2/imgcat -u
document.programPage.TOTALES = {}
document.programPage.__guardarTotales = function() {
const [ INICIAL, VIGENTE, EJECUTADO ] = $('.importe-cabecera-value').map((idx, item) => {
return parseFloat(item.innerText.replaceAll(".", "").replace(",", "."))
})
this.TOTALES = {
"Presupuesto Inicial": INICIAL,
"Presupuesto Vigente": VIGENTE,
@redraw
redraw / songkick.py
Created April 22, 2023 20:47
python songkick.py 119277-cornelius
import sys
import time
import json
import requests
API_KEY = "bes5VlOjJoyrXx6O"
def fetch(session, artist_id, page):
response = session.get(
@redraw
redraw / httpdump.py
Created March 17, 2022 01:04
HTTP dump contents to files
#!/usr/bin/env python
# usage: mitmdump -s httpdump.py "~ts application/json"
#
# options:
# - dumper_folder: content dump destination folder (default: ./httpdump)
# - open_browser: open integrated browser with proxy configured at start (default: true)
#
# remember to add your own mitmproxy authorative certs in your browser/os!
# certs docs: https://docs.mitmproxy.org/stable/concepts-certificates/
# filter expressions docs: https://docs.mitmproxy.org/stable/concepts-filters/
#!/bin/bash
# brew install xbar jq
# pip install astro-cli
PATH=$PATH:/usr/local/bin
ASTRO=$(pyenv which astro)
$ASTRO --date "a week ago" -f json moon phases | jq -r "first | .emoji"
echo "---"
echo "phases | size=10"
let more = true
let data = []
let offset = 0
let next = ""
while (more) {
console.log(`Fetch offset: ${offset}`)
var req = new XMLHttpRequest();
req.open("GET", `https://www.pedidosya.com.ar/my-orders/api/orders?mock=false&previous=${next}&from=&to=&ordersState=`, false);
req.send(null)
curl -sL whatthecommit.com | htmlq "#content p:first-child" -tw | sed '/^$/d'
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@redraw
redraw / gist:f94756a2e2d9627d5af33731162b2d81
Last active March 5, 2021 23:02
el sr @ignaciovidal nos dejo manijas para repasar como funcionaba la herencia multiple en Python
>>> class A():
...: def uno(self):
...: print("A uno")
>>> class B():
...: def uno(self):
...: print("B uno")
...: def dos(self):
...: print("B dos")
...:
@redraw
redraw / thinkpad-hotkeys
Last active January 25, 2021 01:08
Thinkpad T14 ACPI event/action hotkey
# /etc/acpi/events/thinkpad-hotkeys
event=ibm/hotkey
action=/etc/acpi/thinkpad-hotkeys.sh %e