Skip to content

Instantly share code, notes, and snippets.

@redraw
redraw / httpdump.py
Created Mar 17, 2022
HTTP dump contents to files
View httpdump.py
#!/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/
View moon.1d.sh
#!/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"
View pedidosya.js
let more = true
let data = []
let offset = 0
while (more) {
console.log(`Fetch offset: ${offset}`)
var req = new XMLHttpRequest();
req.open("GET", `https://www.pedidosya.com.ar/mobile/v2/users/myOrders?state=CONFIRMED&max=10&offset=${offset}&countryId=3`, false);
req.send(null)
let response = JSON.parse(req.responseText)
View gist:9a03245c5fd54a9902aa1d8a36b32169
curl -sL whatthecommit.com | htmlq "#content p:first-child" -tw | sed '/^$/d'
View sleep-battery-stats.ipynb
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 Feb 19, 2022
/usr/lib/systemd/system-sleep/battery-monitor
View 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 Mar 5, 2021
el sr @ignaciovidal nos dejo manijas para repasar como funcionaba la herencia multiple en Python
View gist:f94756a2e2d9627d5af33731162b2d81
>>> 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 Jan 25, 2021
Thinkpad T14 ACPI event/action hotkey
View thinkpad-hotkeys
# /etc/acpi/events/thinkpad-hotkeys
event=ibm/hotkey
action=/etc/acpi/thinkpad-hotkeys.sh %e
@redraw
redraw / 10-hibernate.conf
Created Jan 15, 2021
hibernate kde neon
View 10-hibernate.conf
# 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
View github-install.sh
#!/bin/bash
# sudo apt install jq wget curl
# usage: github-install user/repo
set -e
repo=$1
tmp="/tmp/.github-install"
binpath="$HOME/.local/bin"
rm -rf $tmp