Skip to content

Instantly share code, notes, and snippets.

View dlangille's full-sized avatar

Dan Langille dlangille

View GitHub Profile
@dlangille
dlangille / gist:2261cff553393d9225ed
Created June 10, 2015 01:40
ntpd does not run on FreeBSD 11.x on Rasperberry Pi 2
[root@dvl /var/log]# /usr/sbin/ntpd -n
8 Jun 18:31:52 ntpd[1090]: ntpd 4.2.8p2-a (1): Starting
8 Jun 18:31:52 ntpd[1090]: Command line: /usr/sbin/ntpd -n
8 Jun 18:31:52 ntpd[1090]: proto: precision = 3.645 usec (-18)
8 Jun 18:31:52 ntpd[1090]: Listen and drop on 0 v6wildcard [::]:123
8 Jun 18:31:52 ntpd[1090]: Listen and drop on 1 v4wildcard 0.0.0.0:123
8 Jun 18:31:52 ntpd[1090]: Listen normally on 2 lo0 [::1]:123
8 Jun 18:31:52 ntpd[1090]: Listen normally on 3 lo0 [fe80::1%1]:123
8 Jun 18:31:52 ntpd[1090]: Listen normally on 4 lo0 127.0.0.1:123
8 Jun 18:31:52 ntpd[1090]: Listen normally on 5 ue0 10.66.66.66:123
@dlangille
dlangille / gist:b42209ea16da256d8578
Created June 29, 2015 18:21
When FreshPorts gets hit by torrent seekers
rm garbage
grep '"-" 408 - "-" "-"' /usr/websites/log/freshports.org-access.log | cut -f 1 -d ' ' > garbage
grep Bittorrent /usr/websites/log/freshports.org-access.log | cut -f 1 -d ' ' >> garbage
grep microsoftupdate /usr/websites/log/freshports.org-access.log | cut -f 1 -d ' ' >> garbage
grep 'GET /announce?info_hash=' /usr/websites/log/freshports.org-access.log | cut -f 1 -d ' ' >> garbage
sort garbage | uniq > allbad
sudo mv allbad /usr/local/etc/bittorent-clients
sudo pfctl -t bittorent-clients -T replace -f /usr/local/etc/bittorent-clients
egrep '"-" 408 - "-" "-"|Bittorrent|microsoftupdate|info_hash|GET /iframe.php|GET /feeds/page.php|GET /banners' /usr/websites/log/freshports.org-access.log | cut -f 1 -d ' ' >> garbage
@dlangille
dlangille / gist:c44265adb7b945da30ee
Last active August 29, 2015 14:24
Tape fails to load
$ sudo mtx -f /dev/pass11 load 14
Loading media from Storage Element 14 into drive 0...mtx: Request Sense: Long Report=yes
mtx: Request Sense: Valid Residual=no
mtx: Request Sense: Error Code=70 (Current)
mtx: Request Sense: Sense Key=Not Ready
mtx: Request Sense: FileMark=no
mtx: Request Sense: EOM=no
mtx: Request Sense: ILI=no
mtx: Request Sense: Additional Sense Code = 04
mtx: Request Sense: Additional Sense Qualifier = 01
swap_pager: indefinite wait buffer: bufobj: 0, blkno: 1450, size: 4096
FreeBSD/amd64 (supernews.unixathome.org) (ttyu0)
login: root
swap_pager: indefinite wait buffer: bufobj: 0, blkno: 1450, size: 4096
swap_pager: indefinite wait buffer: bufobj: 0, blkno: 1450, size: 4096
dan=# select datname, pg_size_pretty(pg_database_size(datname)) from pg_database;
datname | pg_size_pretty
----------------+----------------
bacula156 | 8115 kB
template1 | 6835 kB
bacula157 | 8099 kB
postgres | 6835 kB
template0 | 6537 kB
bacula | 122 GB
bacula100 | 7649 kB
@dlangille
dlangille / device.hints
Last active August 29, 2015 14:25
FreeBSD 10.2-BETA: look at line 234 of dmesg.boot: da19: da20 at mps2 bus 0 scbus11 target 4 lun 0
# $FreeBSD: stable/10/sys/amd64/conf/GENERIC.hints 276986 2015-01-11 17:10:07Z nwhitehorn $
hint.fdc.0.at="isa"
hint.fdc.0.port="0x3F0"
hint.fdc.0.irq="6"
hint.fdc.0.drq="2"
hint.fd.0.at="fdc0"
hint.fd.0.drive="0"
hint.fd.1.at="fdc0"
hint.fd.1.drive="1"
hint.atkbdc.0.at="isa"
@dlangille
dlangille / 01-inputs.conf
Created July 23, 2015 21:15
Logstash configuration
#logstash-forwarder
input {
lumberjack {
port => 5043
type => "logs"
ssl_certificate => "/usr/local/etc/ssl/metrics.int.unixathome.org.crt"
ssl_key => "/usr/local/etc/ssl/metrics.int.unixathome.org.nopassword.key"
codec => plain { charset => "ISO-8859-1" }
}
}
@dlangille
dlangille / messages
Created July 27, 2015 16:50
problem Toshiba HDD DT01ACA300 255BTBPGSTZ6
Jul 27 12:26:24 varm kernel: (da15:mps0:0:7:0): READ(10). CDB: 28 00 25 51 10 d8 00 00 01 00
Jul 27 12:26:24 varm kernel: (da15:mps0:0:7:0): CAM status: SCSI Status Error
Jul 27 12:26:24 varm kernel: (da15:mps0:0:7:0): SCSI status: Check Condition
Jul 27 12:26:24 varm kernel: (da15:mps0:0:7:0): SCSI sense: MEDIUM ERROR asc:11,0 (Unrecovered read error)
Jul 27 12:26:24 varm kernel: (da15:mps0:0:7:0): Info: 0x255110d8
Jul 27 12:26:24 varm kernel: (da15:mps0:0:7:0): Error 5, Unretryable error
Jul 27 12:27:34 varm kernel: (da15:mps0:0:7:0): READ(10). CDB: 28 00 25 51 10 d8 00 00 01 00
Jul 27 12:27:34 varm kernel: (da15:mps0:0:7:0): CAM status: SCSI Status Error
Jul 27 12:27:34 varm kernel: (da15:mps0:0:7:0): SCSI status: Check Condition
Jul 27 12:27:34 varm kernel: (da15:mps0:0:7:0): SCSI sense: MEDIUM ERROR asc:11,0 (Unrecovered read error)
@dlangille
dlangille / check_backup
Created August 3, 2015 14:00
First Sunday are backup days. On those days, the file being checked will age considerably, so let it.
#!/bin/sh
BACKUP=$1
# is today the First Sunday of the month?
# Or the Monday right after it?
if test \( [ "$(date '+%a')" == "Sun" ] && [ "$(date '+%d')" -le "7" ] \) -o test \( [ "$(date '+%a')" == "Mon" ] && [ "$(date '+%d')" -le "8" ] && [ "$(date '+%d')" -ge "2" ] \)
then
WARN=180000
# these are the entries I was playing with in /boot/device.hints
# but they weren't giving me the values I expected
# bottom M1015 card
hint.scbus.10.at="mps0"
hint.da.0.at="scbus10"
hint.da.0.target="0"
hint.da.1.at="scbus10"
hint.da.1.target="1"