Skip to content

Instantly share code, notes, and snippets.

@DuqueDeTuring
DuqueDeTuring / msg_test.go
Created October 25, 2023 02:36 — forked from dcormier/msg_test.go
golang: parsing emails with mime, mime/multipart and net/mail packages
pacakge msgtest
import (
"io"
"mime"
"mime/multipart"
"net/mail"
"net/textproto"
"os"
"path/filepath"
@DuqueDeTuring
DuqueDeTuring / buzz.py
Created December 17, 2022 18:59
a sound to test a pi pico w pin out to speaker
# buzz:
onboard = Pin(22, Pin.OUT)
for i in range(0, 40000):
onboard.on()
time.sleep(0.025)
onboard.off()
time.sleep(0.025)
# /buzz
@DuqueDeTuring
DuqueDeTuring / cleaner.py
Created November 17, 2022 11:32
small http server, receives an html string and returns it converted into text (without: tags, links, tables, images, etc)
from http.server import BaseHTTPRequestHandler, HTTPServer
import html2text
class Handler(BaseHTTPRequestHandler):
def do_POST(self):
try:
data = self.rfile.read(int(self.headers['Content-Length'])).decode("utf-8")
content = h.handle(data.strip()).strip()
print(content)
@DuqueDeTuring
DuqueDeTuring / mastodonsocial_crude_api_test.py
Last active November 16, 2022 12:43
quick&crude test of mastodon's api with micropython
import network
import json
import urequests
from machine import Pin, Timer, I2C
import time
from lcd_api import LcdApi
from i2c_lcd import I2cLcd
HTTP_OK = 200
AUTH_HEADER = {"Authorization":"Bearer API_KEY"}
@DuqueDeTuring
DuqueDeTuring / CMakeLists.txt
Created November 13, 2022 02:08
cmake blink example for pico w
add_executable(blink
blink.c
)
# pull in common dependencies
target_link_libraries(blink pico_stdlib pico_cyw43_arch_none )
# create map/bin/hex file etc.
pico_add_extra_outputs(blink)
@DuqueDeTuring
DuqueDeTuring / .yaml
Created September 24, 2022 03:28
notificación de url actualizado vía mqtt en home assistant
alias: aviso de url actualizado
description: >-
envía una notificación al cel cuando parece que uno de los URL monitoreados
fue actualizado (pág. cambiada).
como cuando una pág. de un producto lo cambia a disponible.
trigger:
- platform: mqtt
topic: url_updated
condition: []
@DuqueDeTuring
DuqueDeTuring / killbutmakeitlooklikeanaccident.sh
Created July 21, 2022 01:01 — forked from moyix/killbutmakeitlooklikeanaccident.sh
Script to inject an exit(0) syscall into a running process. NB: only x86_64 for now!
#!/bin/bash
gdb -p "$1" -batch -ex 'set {short}$rip = 0x050f' -ex 'set $rax=231' -ex 'set $rdi=0' -ex 'cont'
@DuqueDeTuring
DuqueDeTuring / random_matrix8x8.ino
Created May 27, 2022 11:49
8x8 LED Matrix random pixels
#include <Wire.h>
#include <Adafruit_GFX.h>
#include "Adafruit_LEDBackpack.h"
Adafruit_8x8matrix matrix = Adafruit_8x8matrix();
void setup() {
Serial.begin(9600);
Serial.println("8x8 LED Matrix random pixels");
randomSeed(analogRead(0));
@DuqueDeTuring
DuqueDeTuring / d.sh
Created May 11, 2021 10:38
ansible docker centos
---
- hosts: all
become: true
tasks:
- name: quitar docker preinstalado
yum:
name: ['docker-client','docker-client-latest','docker-common','docker-latest','docker-latest-logrotate', 'docker-logrotate', 'docker-engine']
state: removed
@DuqueDeTuring
DuqueDeTuring / b.sh
Created May 11, 2021 10:24
borg create
2 export BORG_PASSCOMMAND="cat $HOME/.borg-passphrase"
3 borg create -v --stats /run/media/blah/internal_backup/repo/::"`dat e --rfc-3339=seconds`" ~/.config/ ~/bin ~/dev ~/.ssh