Skip to content

Instantly share code, notes, and snippets.

View akash73's full-sized avatar

Andrea Richetta akash73

View GitHub Profile

🖥️ Linux Login Welcome Script (Debian/Ubuntu)

This script displays useful system information at login, such as:

  • Hostname, OS, and Kernel
  • Local IP address (IPv4)
  • Wi-Fi SSID (if available)
  • Uptime and load average
  • Disk and memory usage
  • CPU temperature (if lm-sensors is installed)
  • Disk SMART status (if smartmontools is installed)
#!/usr/bin/env bash
# login-welcome.sh — Banner informativo al login per Debian/Linux
# Esci se non interattivo
case $- in *i*) ;; *) return 0 2>/dev/null || exit 0 ;; esac
# colours
if command -v tput >/dev/null 2>&1 && [ -n "$TERM" ] && [ "$TERM" != "dumb" ]; then
BOLD="$(tput bold)"; DIM="$(tput dim)"; RESET="$(tput sgr0)"
@akash73
akash73 / rtc_opta.ino
Created September 2, 2024 10:59
OPTA RTC Snippet
#include "Arduino.h"
#include "RealTimeClock.h"
#include "mbed.h"
void setup() {
Serial.begin(9600);
set_time(1256729737);
timestamp_t res;
}
@akash73
akash73 / arduino_cloud.txt
Created December 11, 2023 10:27
Arduino cloud error codes
85 NSAPI_ERROR_OK = 0, /*!< no error */
86 NSAPI_ERROR_WOULD_BLOCK = -3001, /*!< no data is not available but call is non-blocking */
87 NSAPI_ERROR_UNSUPPORTED = -3002, /*!< unsupported functionality */
88 NSAPI_ERROR_PARAMETER = -3003, /*!< invalid configuration */
89 NSAPI_ERROR_NO_CONNECTION = -3004, /*!< not connected to a network */
90 NSAPI_ERROR_NO_SOCKET = -3005, /*!< socket not available for use */
91 NSAPI_ERROR_NO_ADDRESS = -3006, /*!< IP address is not known */
92 NSAPI_ERROR_NO_MEMORY = -3007, /*!< memory resource not available */
93 NSAPI_ERROR_NO_SSID = -3008, /*!< ssid not found */
94 NSAPI_ERROR_DNS_FAILURE = -3009, /*!< DNS failed to complete successfully */
#Simple POC for recording audio from X8 + Portenta Max Carrier
#possible evolutions: create a container.
export XTERM=zterm
resize
sudo mount -t vfat /dev/mmcblk1p1 /mnt
sudo docker run -it -u '0' --device '/dev/snd:/dev/snd' -v '/mnt:/sdcard' --tmpfs /tmp --name "alsa-utils" debian:stable-slim bash
apt-get update && apt-get install alsa-utils ffmpeg -y
void setup() {
mbed::Watchdog::get_instance().start(10000);
}
void loop() {
mbed::Watchdog::get_instance().kick();
}
; End Gcode
M140 S0 ;Turn-off bed
M106 S0 ;Turn-off fan
M104 S0 ;Turn-off hotend
G91 ;Relative positioning
G1 E-2 F2700 ;Retract a bit
G1 E-2 Z0.2 F2400 ;Retract and raise Z
G1 X5 Y5 F3000 ;Wipe out
G1 Z10 ;Raise Z more
G90 ;Absolute positionning
@akash73
akash73 / Ultimaker_gcode_start.txt
Created May 6, 2023 14:59
Cura Start GCODE for Ender neo v2
;Start Print
G92 E0 ; Reset Extruder
M140 S{material_bed_temperature_layer_0} ; Set Heat Bed temperature
M104 S{material_print_temperature_layer_0} ; Set Extruder temperature
G28 ; Home all axes
M109 S{material_print_temperature_layer_0} ; Wait for Extruder temperature
M190 S{material_bed_temperature_layer_0} ; Wait for Heat Bed temperature
G29 ; Auto bed-level (BL-Touch)
M500 ; Used to store G29 results in memory
G92 E0 ; Reset Extruder
Black Panther X
Elektra X
The Shadow X
Aquaman X
The Defenders X
Fantastic Four X
Wonder Woman X
Asterix X
Batwoman X
Marvelman X