Skip to content

Instantly share code, notes, and snippets.

Dan Langille dlangille

View GitHub Profile
dlangille /
Created Jul 7, 2020
FreshPorts git - echo /usr/local/libexec/freshports/ | sudo su -fm freshports
[dan@devgit-ingress01:~/scripts] $ echo /usr/local/libexec/freshports/ | sudo su -fm freshports
2020.07.07 22:20:58 started
2020.07.07 22:20:58 repo is /var/db/freshports/ports-jail/var/db/repos/PORTS-head-git
2020.07.07 22:20:58 XML dir is /var/db/freshports/message-queues/incoming
2020.07.07 22:20:58 running: /usr/local/bin/git fetch origin
remote: Enumerating objects: 1045, done.
remote: Counting objects: 100% (1045/1045), done.
remote: Compressing objects: 100% (62/62), done.
remote: Total 1913 (delta 985), reused 1041 (delta 982), pack-reused 868
Receiving objects: 100% (1913/1913), 678.31 KiB | 5.34 MiB/s, done.
View zpool zroot_new
root@mfsbsd:~ # zpool import -f -R /dst zroot zroot_new
root@mfsbsd:~ # zpool list
zroot_new 212G 480M 212G - - 0% 0% 1.00x ONLINE /dst
root@mfsbsd:~ # zpool export zroot_new
root@mfsbsd:~ # zpool import -f -R /dst zroot_new
root@mfsbsd:~ # zpool export zroot_new
root@mfsbsd:~ # shutdown -r now
View kernel: Solaris: WARNING: can't open objset 95, error 5
root@mfsbsd:~ # zpool import -f -R /dst zroot_dst
cannot import 'zroot_dst': I/O error
Destroy and re-create the pool from
a backup source.
Jun 20 11:40:19 mfsbsd kernel: ZFS filesystem version: 5
Jun 20 11:40:19 mfsbsd kernel: ZFS storage pool version: features support (5000)
Jun 20 11:40:22 mfsbsd ZFS[2371]: vdev state changed, pool_guid=$10443359089269485823 vdev_guid=$14936720131378251566
Jun 20 11:40:22 mfsbsd ZFS[2372]: vdev state changed, pool_guid=$10443359089269485823 vdev_guid=$4713809697672316496
dlangille / PageLoadSummaryUpdate
Last active May 30, 2020
FreshPorts page logging
View PageLoadSummaryUpdate
CREATE OR REPLACE FUNCTION PageLoadSummaryUpdate(date) returns int AS $$
l_RowCount int;
INSERT INTO page_load_summary (date, page_name, total, users, rendering_time_min, rendering_time_max, rendering_time_avg)
SELECT date,
CASE WHEN page_name = '/missing.php' THEN
CASE WHEN position('?' in full_url) != 0 THEN
substring(full_url from 0 for position('?' in full_url))
dlangille / 0 - pick any user
Last active May 9, 2020
Why is the home directory = / when running from daemon(8)?
View 0 - pick any user
I used librenms, but it works with any user:
$ grep librenms /etc/passwd
librenms:*:249:249:LibreNMS pseudo-user:/var/db/librenms/home:/bin/sh
NOTE: I'm taking a different approach which does not rely upon a HOME directory.
View 1 - System update failed!
>>> Updating repositories metadata...
Updating pfSense-core repository catalogue...
Fetching meta.txz: . done
Fetching packagesite.txz: . done
Processing entries: . done
pfSense-core repository update completed. 6 packages processed.
Updating pfSense repository catalogue...
Fetching meta.txz: . done
Fetching packagesite.txz: .......... done
Processing entries:
dlangille / 1 - pip install
Last active Apr 30, 2020
Getting mqttwarn running with Python 3.7 on FreeBSD
View 1 - pip install
pip install is good, but it's not a package. I'm trying to build a port so folks can install from a package.
[dan@empty:~/librenms] $ sudo pip install mqttwarn
Collecting mqttwarn
Downloading (105kB)
|████████████████████████████████| 112kB 3.7MB/s
Collecting six==1.13.0 (from mqttwarn)
set -e
# invoke this to get the right value for $LOGGER
$LOGGER -t ${LOGGERTAG} starts
View Running commands via psql begin;
BEGIN UPDATE packages_raw PR SET abi_id = null, port_id = null FROM abi, ports_origin PO WHERE PR.abi = 'FreeBSD:13:aarch64' AND PR.package_set = 'latest' AND PR.abi = AND PO.port_origin = PR.package_origin;
View UpdatePackagesFromRawPackages
CREATE OR REPLACE FUNCTION UpdatePackagesFromRawPackages( IN a_abi_name text, IN a_package_set package_sets)
RETURNS TABLE(inserts integer, updates integer, deletes integer)
AS $$
l_abi_id integer;
l_inserts integer;
l_deletes integer;
l_updates integer;
You can’t perform that action at this time.