Skip to content

Instantly share code, notes, and snippets.

View i3130002's full-sized avatar

Mahdi Rafatjah i3130002

View GitHub Profile
@i3130002
i3130002 / .bashrc
Created October 12, 2023 17:46
Asus A15 2023 Battery Charging Threshold Linux
#Battery Threshold
# Add these Aliases to ~/.bashrc to be able to set battery charging levels to 50-60-70-80-90-100.
#(It appears that lower values than 53 will be ignored)
#Requires SUDO access
# Sources:
# https://www.linuxuprising.com/2021/02/how-to-limit-battery-charging-set.html
# https://askubuntu.com/questions/1006778/set-battery-thresholds-on-ubuntu-asus
# Alias:
@i3130002
i3130002 / gnome-screenshot-to-file.sh
Last active September 17, 2022 07:23
gnome-screenshot area to ~pictures/gnome-screenshot/
#!/usr/bin/env bash
now=`date +"%Y-%m-%d %H-%M-%S"`
gnome-screenshot -a -f "Pictures/gnome-screenshot/${now}.png"
# One can use keyboard shortcuts to call above script and ...
@i3130002
i3130002 / FastSerialPlotter.md
Last active January 26, 2022 07:37
Python Serial Plotter

Python Serial Plotter High Frequency UART Plot AVR Arduino

This code plots serial data using mathplotlib and with high frequency. You might use it as a crude oscilloscope

import serial
from threading import Thread
import threading
import time
import matplotlib.pyplot as plt
import matplotlib.animation as animation

Mikrotik log interface(ether1) traffic

This can be placed on an scheduler and logs your traffic like every hour or so.

{
:set $tx ([/interface get ether1 tx-byte]/1048576)
:set $rx ([/interface get ether1 rx-byte]/1048576)
:log debug "Traffic log,TX,$tx,RX,$rx;"
}

The log of script can be set to disk file for persistance

Define component with default props:

interface IProps{
  propName:boolean;
}

export default function ComponentName(props?:IProps) {
  const {propName=false} = props?props:{}
}