Skip to content

Instantly share code, notes, and snippets.

@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 / battery-monitor
Last active February 19, 2022 12:05
/usr/lib/systemd/system-sleep/battery-monitor
#!/bin/bash
# battery monitor systemd suspend/resume hook
LOGFILE=/var/log/battery.csv
KERNEL=$(uname -r)
BIOS=$(dmidecode -s bios-version)
log() {
cd /sys/class/power_supply
@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
@redraw
redraw / 10-hibernate.conf
Created January 15, 2021 21:30
hibernate kde neon
# particion swap size = ram
# gettear UUID con blkid
# en /etc/grub/default agregar,
# quiet splash resume=UUID=<UUID-swap-partition>
# sudo update-grub
# sudo vim /etc/polkit-1/localauthority.conf.d/10-hibernate.conf
[Re-enable hibernate by default for login1]
Identity=unix-user:*
Action=org.freedesktop.login1.hibernate