Skip to content

Instantly share code, notes, and snippets.

View dlangille's full-sized avatar

Dan Langille dlangille

View GitHub Profile
@dlangille
dlangille / StripLeadingPrefix
Created November 24, 2020 19:18
FreshPorts element strip repo head /ports/head /ports/branches/2020Q4
sub StripLeadingPrefix {
# take an element name, and remove the leading /ports/head or /ports/branches/foo from the path name
# for example: /ports/head/lang/yap/Makefile
# /ports/head/lang/yap/files/patch-Makefile.in
# /ports/head/lang/yap/pkg-descr
# split the incoming path up by /
# This will have a leading /, so we wind up with
#
@dlangille
dlangille / History
Created October 10, 2020 22:55
/dev/gpt didn't take the first time. I don't know why
I got the labels wrong, I was reading dmesg output incorrectly.
41 22:47 gpart modify -l S59VNJ0N631973D -i 1 da3
42 22:47 gpart modify -l S5B3NDFN807386P -i 1 da4
43 22:47 gpart modify -l S59VNS0N809087J -i 1 da5
44 22:47 gpart modify -l S59VNS0N809087J -i 1 da2
45 22:48 gpart modify -l S5B3NDFN807386P -i 1 da5
46 22:48 gpart modify -l S59VNJ0N631973D -i 1 da3
47 22:48 gpart modify -l S5B3NDFN807383E -i 1 da4
@dlangille
dlangille / gist:5060e2f1d91e7e1bed9b8ff11784b2ea
Created August 31, 2020 01:18
allow unattended updates
diff --git a/src/share/mkjail/update.sh b/src/share/mkjail/update.sh
index ef34aa9..ad6e639 100755
--- a/src/share/mkjail/update.sh
+++ b/src/share/mkjail/update.sh
@@ -25,7 +25,7 @@ _alljails()
echo "Updating ${JAILNAME} jail..."
echo ""
export UNAME_r=$(_get_version)
- freebsd-update -b ${JAILROOT}/${JAILNAME} -f ${JAILROOT}/${JAILNAME}/etc/freebsd-update.conf -F fetch install
+ PAGER=cat freebsd-update -b ${JAILROOT}/${JAILNAME} -f ${JAILROOT}/${JAILNAME}/etc/freebsd-update.conf -F fetch install
from /etc/pf.conf:
PUBLIC="ix2"
MYSELF="163.237.218.22"
nat on ix2 from 10.163.0.0/24 to any -> 163.237.218.22
pass in all
@dlangille
dlangille / events
Created August 13, 2020 20:27
Using the events API to detect commits
[dan@pro02:~] $ curl -H "Authorization: token MYTOKEN" https://api.github.com/repos/freebsd/freebsd/events | grep 0d19f9ca2fba9df8176b5439518a0a7d946b9abd
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 82145 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 "head": "0d19f9ca2fba9df8176b5439518a0a7d946b9abd",
"sha": "0d19f9ca2fba9df8176b5439518a0a7d946b9abd",
"url": "https://api.github.com/repos/freebsd/freebsd/commits/0d19f9ca2fba9df8176b5439518a0a7d946b9abd"
100 82145 100 82145 0 0 205k 0 --:--:-- --:--:-- --:--:-- 204k
[dan@pro02:~] $
credit to cem
@dlangille
dlangille / librenms.1.66.diff
Created August 10, 2020 19:12
FreeBSD net-mgmt/librenms update to 1.66
Index: Makefile
===================================================================
--- Makefile (revision 544642)
+++ Makefile (working copy)
@@ -2,8 +2,7 @@
# $FreeBSD$
PORTNAME= librenms
-PORTVERSION= 1.65.1
-PORTREVISION= 3
[dan@empty:~/librenms] $ ./scripts/composer_wrapper.php install --no-devl --no-dev
> LibreNMS\ComposerHelper::preInstall
Loading composer repositories with package information
Installing dependencies from lock file
Package operations: 83 installs, 0 updates, 0 removals
- Installing symfony/dotenv (v3.4.42): Loading from cache
- Installing amenadiel/jpgraph (3.6.21): Loading from cache
- Installing clue/socket-raw (v1.4.1): Loading from cache
- Installing dapphp/radius (2.5.4): Loading from cache
- Installing voku/portable-ascii (1.5.2): Loading from cache
@dlangille
dlangille / 1 - a problem with the FreeBSD 1.65.1 port
Last active August 5, 2020 15:12
Creating vendor tarball for LibreNMS 1.66
[16:35:24] <lnms-discord> <dvlO> We're on 1.65.1 and our Global Settings page is empty, but for @routes.
....
[17:25:47] <lnms-discord> <jellyfrogO> @dvl what happens if you run ./lnms translation:generate?
[17:26:17] *** Joins: Cheeze_It (~Cheeze_It@71-33-223-224.hlrn.qwest.net)
[17:26:25] <lnms-discord> <dvlO> The command "vue-i18n:generate" does not exist.
[17:26:49] <lnms-discord> <dvlO> @jellyfrog that's interesting. something missing from our install?
[17:27:29] <lnms-discord> <murrantO> @dvl devel dependency
[17:28:02] <lnms-discord> <dvlO> is that something I omitted from the vendor file?
@dlangille
dlangille / sudo iocage restart x8dtu-nginx01
Created July 25, 2020 14:10
Messed up, removed most of jail
[dan@x8dtu:/iocage/jails/x8dtu-nginx01/root] $ sudo iocage restart x8dtu-nginx01
* Stopping x8dtu-nginx01
+ Executing prestop OK
+ Stopping services OK
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/iocage_lib/ioc_stop.py", line 189, in __stop_jail__
child], stderr=su.STDOUT)
File "/usr/local/lib/python3.7/site-packages/iocage_lib/ioc_common.py", line 612, in checkoutput
out = su.check_output(*args, **kwargs)
File "/usr/local/lib/python3.7/subprocess.py", line 411, in check_output
@dlangille
dlangille / 1 - 2020.07.21.17.15.07.000000.24204ab75f8f780d312b56745536862be7120adc.xml
Last active July 24, 2020 12:29
The Log entry in this XML file is giving me a 'Wide character in subroutine entry' when I try to print it. I'm using XML::Node to parse it. When I call DBI's quote function, I get that error message. I have no idea how to deal with this.
<?xml version='1.0' encoding='UTF-8'?>
<UPDATES Version="1.4.0.0">
<UPDATE>
<DATE Year="2020" Month="7" Day="21"/>
<TIME Timezone="UTC" Hour="17" Minute="15" Second="7"/>
<OS Repo="ports" Id="FreeBSD" Branch="master"/>
<LOG>- Add devel/py-trio: Friendly Python library for async concurrency and I/O
The Trio project’s goal is to produce a production-quality,
permissively licensed, async/await-native I/O library for Python.