Skip to content

Instantly share code, notes, and snippets.

View dlangille's full-sized avatar

Dan Langille dlangille

View GitHub Profile
@muendelezaji
muendelezaji / bash-to-zsh-hist.py
Created October 5, 2016 14:18 — forked from op/bash-history-to-zsh-history.py
Convert Bash history to Zsh history
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This is how I used it:
# $ cat ~/.bash_history | python bash-to-zsh-hist.py >> ~/.zsh_history
import sys
import time
@starkers
starkers / prune_old_vols.sh
Last active August 28, 2023 11:11
prune delete and remove old bacula volumes
#!/usr/bin/env bash
#set -x
# Prune and volumes older than 2 months:
PAST=`date --date='-2 months 0 day ago' +%Y-%m-%d`
#EG a hard coded date
#PAST="2012-11-29"
#PAST="2013-11-29"
@dlangille
dlangille / pkg-audit.sh
Last active March 1, 2022 12:57
Find all pkg audit issues in FreeBSD jails and hosts.
#!/bin/sh
JLS="/usr/sbin/jls"
PKG="/usr/sbin/pkg"
# list of the jail ids for all jails
JAILS=`${JLS} jid`
RESULT=""
CHECKING=$1
@dlangille
dlangille / diff which fixes processing
Last active December 10, 2017 18:50
The FreshPorts vuxml fix
Index: process_vuxml.pl
===================================================================
--- process_vuxml.pl (revision 5009)
+++ process_vuxml.pl (working copy)
@@ -90,36 +90,49 @@
if ($updateRequired)
{
+ print "about to open\n";
+# print $vulns{$v};
@dlangille
dlangille / 01 - existing 3TB drive
Last active July 25, 2017 11:08
Swapping 3TB out, swapping 5TB in
$ gpart show da2
=> 34 5860533101 da2 GPT (2.7T)
34 94 1 freebsd-boot (47K)
128 16777216 2 freebsd-swap (8.0G)
16777344 5838471168 3 freebsd-zfs (2.7T)
5855248512 5284623 - free - (2.5G)
@dlangille
dlangille / 3TB drives x 12
Last active September 26, 2016 08:42
List of drives for testing
$ sudo camcontrol devlist | grep DT01ACA3
<ATA TOSHIBA DT01ACA3 ABB0> at scbus10 target 8 lun 0 (pass8,da6)
<ATA TOSHIBA DT01ACA3 ABB0> at scbus11 target 0 lun 0 (pass10,da8)
<ATA TOSHIBA DT01ACA3 ABB0> at scbus11 target 1 lun 0 (pass11,da9)
<ATA TOSHIBA DT01ACA3 ABB0> at scbus11 target 2 lun 0 (pass12,da10)
<ATA TOSHIBA DT01ACA3 ABB0> at scbus11 target 3 lun 0 (pass13,da11)
<ATA TOSHIBA DT01ACA3 ABB0> at scbus13 target 4 lun 0 (pass22,da20)
<ATA TOSHIBA DT01ACA3 ABB0> at scbus13 target 5 lun 0 (pass23,da21)
<ATA TOSHIBA DT01ACA3 ABB0> at scbus13 target 7 lun 0 (pass24,da22)
<ATA TOSHIBA DT01ACA3 ABB0> at scbus13 target 8 lun 0 (pass25,da23)
@dlangille
dlangille / JobDefs
Last active March 14, 2016 15:32
Bacula virtual disk configuration, based on http://blog.bacula.org/whitepapers/CommunityDiskBackup.pdf
I have this defined in all job defs. Otherwise, a job might want to use a Volume already
mounted and in use by an existing job. This directive tells it to use another Volume,
which would be mounted on another drive.
JobDefs {
...
PreferMountedVolumes = no
...
}
@dlangille
dlangille / Upload this file instead
Created March 10, 2016 16:55
When you can't run arc diff for reviews.freebsd.org
e.g. but 'arc diff' fails with svn: warning: W200017: Property 'svn:mime-type'
not found on '/usr/ports/textproc/elasticsearch2-plugin-marvel@
svn diff --diff-cmd=diff -x -U9999
@dlangille
dlangille / check_host_vs_jails.sh
Last active August 29, 2015 14:17
Compare iocage jail version against the host - nagios check
#!/bin/sh
HOSTVERSION=`/usr/bin/file /bin/sh`
JAILS=`/usr/local/sbin/iocage list | /usr/bin/egrep -v '^JID' | /usr/bin/cut -f 2 -w`
ERRORS=''
for jail in ${JAILS}
do
JAILVERSION=`/usr/local/sbin/iocage chroot ${jail} 'file /bin/sh'`
if [ "${JAILVERSION}" != "${HOSTVERSION}" ]