Skip to content

Instantly share code, notes, and snippets.

Avatar
🏢
Working

coseos coseos

🏢
Working
View GitHub Profile
View JPA_GeneratedValue.md

JPA @Identity Stragey values

Just to remember the strategies available in JPA for id generation. In most cases, AUTO will work fine as in

@Id
@GeneratedValue(strategy=GenerationType.AUTO)

Sometimes AUTO does not work. Use IDENTITY for a database that supports autoincement columns and SEQUENCE for a database that supports sequences. Few databases require TABLE

View main.py
# Simple Python Script to flash LED on Raspberry Pi Pico
from machine import Pin
import time
led = Pin(25, Pin.OUT)
while True:
led.toggle()
time.sleep_ms(100)
View bridge.sh
#!/usr/bin/env bash
#
# Credits for this script to:
#
# https://www.willhaley.com/blog/raspberry-pi-wifi-ethernet-bridge/
#
# Run this script on your Raspberry Pi (Bullseye) to turn it into a bridge.
#
# You can now connect a network printer to the ethernet port of your
View python-exit-ctrl-c.py
#!/usr/bin/python
# This is a template on how to add a CTRL-C handler in your Python script
#
# With this handler, you can include a proper cleanup before the script is terminated.
#
from signal import signal, SIGINT
from sys import exit
View typelog.js
// typelog: a simple function to log the type and value of a variable
//
// This is a short function to show the type and value of a variable that i use in my JavaScript trainings.
// It helps students to understand what they are working with in JavaScript, since JavaScript does not
// require programmers to provide the data type for a variable.
//
// Example:
//
// typelog( "A string" );
// typelog( 42 );
View DX.bin
{"timestamp": "2022-11-04T09-00-01_00-00", "state": "U2FsdGVkX1+AyIV8Mkc/W/uc3THqGxYRDVfu0XJwtEA="}
View Linux crontab shortcuts.md

Linux crontab shortcuts

With cron, you can use some shortcuts that let you see when an entry is triggered without remembering the more difficult numbers that you would have to put there:

Synonym        Meaning and equivalent crontab values
-----------    ---------------------------------------------------
@reboot        Run once, at startup (only works with this synonym)
@yearly        Run once a year, equals "0 0 1 1 *".
@annually (same as @yearly)
View Docker on Raspberry Pi 4.md

Docker on Raspberry Pi 4

It's so simply to use Docker on the Raspberry Pi. All you have to do is:

sudo apt-get update -y && sudo apt-get upgrade -y && sudo apt-get install docker.io

sudo usermod -aG docker pi

sudo systemctl reboot
@coseos
coseos / Razer-Book-13_with_Debian-Bullseye_Fix-Audio-problem.md
Created Jun 6, 2022
Razer Book 13 with Debian Bullseye Fix Audio problem
View Razer-Book-13_with_Debian-Bullseye_Fix-Audio-problem.md

Razer Book 13 with Debian Bullseye: Fix Audio Problem

The Razer Book 13 is my second Razer notebook. The fine silver makes a nice difference to the beautiful black of the Stealh 13. Even though the technical specs leave some wishes open as 16 GB of RAM is the max, the look and touch is great. In my opinion this is the most beautiful non black notebook available in 2022.

Razor Book 13

Audio may not work out of the box though when you install Debian Bullseye (11) on your Razor Book 13.

When your output lists only the Dummy-device, fix that with the following command (run as root):