Skip to content

Instantly share code, notes, and snippets.

@jtornero
jtornero / bootlog.txt
Created May 25, 2023 11:12
Rockpi 4C+ debian booting through LTSP boot log
U-Boot latest-2022.10-1-4debc57a-00007-gb923c1b6 (Mar 06 2023 - 15:54:16 +0000)
SoC: Rockchip rk3399
Reset cause: POR
Model: Radxa ROCK 4C+
DRAM: 3.9 GiB
PMIC: RK8090 (on=0x80, off=0x10)
Core: 283 devices, 27 uclasses, devicetree: separate
MMC: mmc@fe310000: 2, mmc@fe320000: 1, mmc@fe330000: 0
Loading Environment from MMC... Card did not respond to voltage select! : -110
@jtornero
jtornero / gist:8e95ab459de679fc523ae66ff30ae35c
Last active June 17, 2022 07:44
Issues with Raspberry Pi booting
#### UPDATE
FOR RPI CLIENTS SOLVED WITH
sudo mkdir -p /srv/tftp/srv; sudo ln -s ../.. /srv/tftp/srv/tftp
as suggested by alkisg at IRC CHANNEL
More information available also at
https://irclogs.ltsp.org/?d=2022-05-16
In this example, gm_previo is where the points are stored and acoustic_transect where the lines live
select
t1.survey,
t2.evaluation_code,
t1.interv,
(t1.date_m||' '||t1.time_m)::timestamp as interv_tmp,
t1.radial,
t2.species_code,
# RASPBERRY PI OUTPUT
root@raspberrypi:~# cat /proc/cmdline /proc/mounts
coherent_pool=1M 8250.nr_uarts=0 snd_bcm2835.enable_compat_alsa=0 snd_bcm2835.enable_hdmi=1 bcm2708_fb.fbwidth=1280 bcm2708_fb.fbheight=1024 bcm2708_fb.fbswap=1 vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000 ip=dhcp root=/dev/nfs nfsroot=192.168.2.1:/srv/ltsp/raspios,vers=3,tcp,nolock init=/usr/share/ltsp/client/init/init ltsp.image=images/raspios.img console=ttyS0,115200 console=tty1 elevator=deadline fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles modprobe.blacklist=bcm2835_v4l2
192.168.2.1:/srv/ltsp/raspios / nfs rw,relatime,vers=3,rsize=4096,wsize=4096,namlen=255,hard,nolock,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=192.168.2.1,mountvers=3,mountproto=tcp,local_lock=all,addr=192.168.2.1 0 0
devtmpfs /dev devtmpfs rw,relatime,size=439912k,nr_inodes=109978,mode=755 0 0
sysfs /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0
proc /proc proc rw,relatime 0 0
securityfs /sys/kernel/security securityfs rw,n
# I have this hard-coded label template, to simplify something like
label="""My label title is %s.
And %s likes it.
""" %(title, name)
return label
# Question: How could I load a similar template from a file but still being able to interpolate the strings?
# First thought is something like
# file template.txt content should be something liie
@jtornero
jtornero / convert.sh
Last active January 19, 2022 16:09
Trying to import data into a PostgreSQL database with mdb-tools and a shell script
# Thanks to ne2k from #postgresql IRC for the tips on quoting and getting data into the db
#!/usr/bin/bash
access_db_name=$1
destination_db=$2
user=$3
postgres_db_name=${access_db_name,,}
#echo "$postgres_db_name"
@jtornero
jtornero / testJSON.sql
Last active April 28, 2021 10:27
Función para modificar JSONB
# Aspecto final de la función siguiendo consejos de Octavio/Jaime Casanova
CREATE or replace FUNCTION updatevar(dat jsonb, variable varchar,newval numeric)
RETURNS jsonb AS
$BODY$
DECLARE
update_query varchar;
newjson jsonb;
BEGIN
@jtornero
jtornero / gist:497086517765d2a3096a0f5ff367d66d
Last active April 15, 2021 15:05
Pivoting con postgres, 2
CREATE or replace FUNCTION alk5(year int, quarter int, species_code varchar)
RETURNS setof mytype AS
$BODY$
DECLARE
fields_query varchar;
fields_list varchar;
alk_query varchar;
type_query varchar;
type2_query varchar;
ages record;
Supongamos que partimos de la siguiente tabla o, en este caso, vista:
Vista «public.alk_05»
Columna | Tipo |
--------------+-----------------------+
survey | character varying(20) |
year | double precision |
quarter | numeric |
month | integer |
species_code | character varying(5) |
#!/usr/bin/env python3
from PyQt5 import QtCore, QtGui, QtSql, QtWidgets
import sys
import os
class SpeciesChooser(QtWidgets.QWidget):
def __init__(self, survey, vessel, db):
super().__init__()
self.db=db