Skip to content

Instantly share code, notes, and snippets.

@jalexandre0
jalexandre0 / gist:aa67d17ef82ea7ec0482fa1701c6582f
Last active October 29, 2017 14:34
Experimental data analysis on brewersfriend recipe database. Work in progress
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jalexandre0
jalexandre0 / get_memory_info.sql
Created February 12, 2019 19:03 — forked from fabriziomello/get_memory_info.sql
Get memory info from a certain process
-- https://psutil.readthedocs.io/en/latest/#psutil.Process.memory_full_info
-- Linux: 0=rss, 1=vms, 2=shared, 3=text, 4=lib, 5=data, 6=dirty, 7=uss, 8=pss, 9=swap
CREATE OR REPLACE FUNCTION get_memory_info(pid INTEGER DEFAULT NULL, memtype INTEGER DEFAULT 0)
RETURNS BIGINT
AS
$$
import psutil
p = psutil.Process(pid)
return p.memory_full_info()[memtype]
$$
@jalexandre0
jalexandre0 / check_backup_label.sql
Created July 28, 2020 20:38
SQL to parse and extract information from pg_wal (or pg_xlog) *.backup
SELECT
min(times) AS start_time,
max(times) AS stop_time,
max(times) - min(times) AS duration,
now() - min(times) AS delta_backup_time_from_start,
now() - max(times) AS delta_backup_time_from_finish,
pg_is_in_backup()
FROM
( SELECT
((regexp_matches(pg_read_file(waldir || filename), '[0-9]*-[0-9]*-[0-9]* [0-9]*:[0-9]*:[0-9]*',
@jalexandre0
jalexandre0 / printer.cfg
Last active April 15, 2023 13:44
Klipper config for Ender 3 + CR Touch + Dual Gear Extruder
[include mainsail.cfg]
[mcu]
serial: /dev/serial/by-id/usb-Klipper_stm32g0b1xx_19001B000550415339373620-if00
restart_method: command
#[mcu zboard]
#serial: /dev/serial/by-id/usb-Klipper_stm32f103xe_56FF69067189545028462567-if00
#restart_method: command
# generated by SuperSlicer 2.4 on 2023-06-09 at 19:05:38 UTC
[print:First Layer Test]
allow_empty_layers = 0
avoid_crossing_not_first_layer = 1
avoid_crossing_perimeters = 0
avoid_crossing_perimeters_max_detour = 0
bottom_fill_pattern = monotonicgapfill
bottom_solid_layers = 3
bottom_solid_min_thickness = 0