Skip to content

Instantly share code, notes, and snippets.

@rafacouto
rafacouto / x240-mouse-driver.sh
Created March 6, 2023 00:02
Script to reload the psmouse driver on x240 laptop
#!/bin/sh
# put this file on /lib/systemd/system-sleep/x240-mouse-driver
# to reload the psmouse driver on sleep events
# further info: `man systemd-sleep`
#PATH=/sbin:/usr/sbin:/bin:/usr/bin
case "$1" in
pre)
@rafacouto
rafacouto / exceptions-tree.php
Created August 11, 2022 11:59 — forked from mlocati/exceptions-tree.php
Throwable and Exceptions tree
<?php
if (!function_exists('interface_exists')) {
die('PHP version too old');
}
$throwables = listThrowableClasses();
$throwablesPerParent = splitInParents($throwables);
printTree($throwablesPerParent);
if (count($throwablesPerParent) !== 0) {
die('ERROR!!!');
@rafacouto
rafacouto / golang-aliases.md
Last active November 5, 2021 18:28
An useful alias to check your golang module promiscuity

An useful alias to check your golang module promiscuity.

Put this line on ~/.bashrc

alias gopromiscuity='source <(go env | grep GOPATH) && echo "Your module promiscuity with golang is level $(find $GOPATH/pkg -name *.mod | wc -l)!"'

gopromiscuity demo

@rafacouto
rafacouto / LICENSE.md
Created May 2, 2021 13:54 — forked from noelbundick/LICENSE.md
Resize Azure Cloud Shell storage

MIT License

Copyright (c) 2018 Noel Bundick

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

@rafacouto
rafacouto / grafana_telegram_bot.md
Created May 1, 2021 22:32 — forked from ilap/grafana_telegram_bot.md
Grafana Telegram Alert

Config Telegrambot for grafana's alerts.

1. Create bot

Open Telegram and search for @BotFather user and message them the following:

You
/newbot 

BotFather
@rafacouto
rafacouto / main.rs
Created June 21, 2020 18:05
My first blinky with Rust embedded
#![no_std]
#![no_main]
use panic_halt as _; // you can put a breakpoint on `rust_begin_unwind` to catch panics
use cortex_m_rt::entry;
use stm32f4xx_hal as hal;
use crate::hal::{prelude::*, stm32};
#[entry]
#include <Arduino.h>
#include "LCDHAL.h"
#include "PINOUT.h"
#include <stdio.h>
LCDHAL ReespiratorLCD;
void setup()
{
#include <Arduino.h>
#include "LCDHAL.h"
#include "PINOUT.h"
LCDHAL* LCDHAL::_lcdInstance = NULL;
int (*LCDHAL::_oriPutchar)(char, FILE *) = NULL;
int LCDHAL::_lcdPutchar(char c, FILE *stream)
{
_lcdInstance->LCDPutchar(c);
@rafacouto
rafacouto / mux-band-tdt-es.sh
Last active March 1, 2020 12:28
Shows the relation between Spanish TDT MUX offset and its MHz frequency.
#!/bin/bash
for mux in $(seq 21 1 60) ; do echo "MUX $mux --> $((482 + (($mux - 22) * 8))) MHz" ; done
#include <Arduino.h>
#include <stdint.h>
#include <avr/io.h>
uint16_t vcc_millivolts(uint8_t delay_us = 50)
{
// select AVCC as reference and switch the internal band-gap (1.1V)
ADMUX = 0b01011110;