Skip to content

Instantly share code, notes, and snippets.

View dreamcat4's full-sized avatar
😋

Dreamcat4 dreamcat4

😋
View GitHub Profile
Copyright (c) 1992-2013 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 9.2-RELEASE-p3 #0 r262572+7b72365: Fri Mar 14 15:50:04 PDT 2014
root@build.ixsystems.com:/home/jkh/9.2.1-BRANCH/freenas/os-base/amd64/tank/home/jkh/9.2.1-BRANCH/freenas/FreeBSD/src/sys/FREENAS.amd64 amd64
gcc version 4.2.1 20070831 patched [FreeBSD]
CPU: Intel(R) Core(TM)2 Duo CPU T7300 @ 2.00GHz (1995.04-MHz K8-class CPU)
Origin = "GenuineIntel" Id = 0x6fb Family = 0x6 Model = 0xf Stepping = 11
Features=0xbfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE>
@dreamcat4
dreamcat4 / zext_msmtp.sh
Last active August 29, 2015 14:03
SMTP email script. Zabbix extensions (C) 2011-* Joseph Bueno <zabbixextensions@aperto.fr>
#! /bin/sh
################################################################################
# Zabbix extensions (C) 2011-* Joseph Bueno <zabbixextensions@aperto.fr>
# Source: http://shirker.blog.com/2012/08/04/zabbix-through-gmail/
# Published under GNU General Public License version 2 or later.
# See LICENSE.txt
#-------------------------------------------------------------------------------
# Usage:
# zext_msmtp.sh <recipient> <subject> <message>
#
@dreamcat4
dreamcat4 / qjail-3.4-92.patch
Created July 1, 2014 19:46
qjail-3.4.patch: 9.2 (For Finch)
diff -rupN qjail-3.4/usr/local/bin/qjail qjail-3.4-92/usr/local/bin/qjail
--- qjail-3.4/usr/local/bin/qjail 2014-07-01 20:41:32.000000000 +0100
+++ qjail-3.4-92/usr/local/bin/qjail 2014-07-01 20:45:24.000000000 +0100
@@ -1814,7 +1814,7 @@ install () {
number=`echo "${release_number}" | awk '{print $1}'`
number=${number}`echo "${release_number}" | awk '{print $2}'`
- if [ ${number} -ge 93 ]; then
+ if [ ${number} -ge 92 ]; then
installarch=`uname -p`
@dreamcat4
dreamcat4 / qjail-3.4-92-rc-d-fix.patch
Last active August 29, 2015 14:03
Fix qjail-3.4 to work on FreeBSD 9.2, and rc.d startup bug (for Finch)
diff -ruN qjail-3.4/usr/local/bin/qjail qjail-3.4-92-rc-d-fix/usr/local/bin/qjail
--- qjail-3.4/usr/local/bin/qjail 2014-07-01 20:41:32.000000000 +0100
+++ qjail-3.4-92-rc-d-fix/usr/local/bin/qjail 2014-07-01 20:45:24.000000000 +0100
@@ -1814,7 +1814,7 @@
number=`echo "${release_number}" | awk '{print $1}'`
number=${number}`echo "${release_number}" | awk '{print $2}'`
- if [ ${number} -ge 93 ]; then
+ if [ ${number} -ge 92 ]; then
installarch=`uname -p`
@dreamcat4
dreamcat4 / webcamd
Last active August 29, 2015 14:03
Improved rc.d script for webcamd
#!/bin/sh
# $FreeBSD: head/multimedia/webcamd/files/webcamd.in 353901 2014-05-12 22:01:10Z nox $
#
# PROVIDE: webcamd
# REQUIRE: DAEMON LOGIN
# KEYWORD: shutdown
#
# ================================================================
# Webcamd is enabled by adding the following line to /etc/rc.conf:
# ================================================================
@dreamcat4
dreamcat4 / qjail-3.5-92.patch
Created July 11, 2014 06:09
qjail-3.4.patch: 9.2 (For Finch)
diff -ruN qjail-3.5/usr/local/bin/qjail qjail-3.5-92/usr/local/bin/qjail
--- qjail-3.5/usr/local/bin/qjail 2014-07-11 07:07:31.000000000 +0100
+++ qjail-3.5-92/usr/local/bin/qjail 2014-07-11 07:08:01.000000000 +0100
@@ -1814,7 +1814,7 @@
number=`echo "${release_number}" | awk '{print $1}'`
number=${number}`echo "${release_number}" | awk '{print $2}'`
- if [ ${number} -ge 93 ]; then
+ if [ ${number} -ge 92 ]; then
installarch=`uname -p`
@dreamcat4
dreamcat4 / smartparam
Last active August 29, 2015 14:03
smartparam <device> <Smart_Parameter> (for zabbix) returns an integer value
#!/bin/sh
#
# smartparam <device> <Smart_Parameter>
#
#
if [ $# -ne 2 ]; then
echo "Usage: $0 <device> <Smart_Parameter>"
echo "Usage: $0 <device> highest_error"
exit
@dreamcat4
dreamcat4 / test.c
Last active August 29, 2015 14:04
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <netinet/in.h>
#include <arpa/inet.h>
@dreamcat4
dreamcat4 / cx88.md
Last active August 29, 2015 14:04
How to Install CX88 drivers on FreeBSD, FreeNAS / NAS4Free / pfSense, with Finch v1.25 - http://dreamcat4.github.io/finch/

NOTE: I don't own this device. Please report back any problems / corrections.

Cx88 How-To (Hauppage WinTV HVR-4000)

These devices need their own special kernel module, and do not use webcamd. Namely, this driver supports the Hauppauge WinTV HVR-4000 and similar chipset devices. More information about these devices is available from the cx88 wiki page. You can also find the cx88 listed in the FreeBSD WebcamCompat page.

This howto configures the necessary cx88 kernel modules to be loaded by Finch. You will need to follow the steps here. Most of these commands can just be copy-pasted. The Kernel modules must be installed directly in Finch's chroot. That can't be done in a jail.

@dreamcat4
dreamcat4 / output.sh
Created July 25, 2014 10:11
swapon: /dev/zvol/pool0/swap: Operation not supported by device
freenas ~/ root~$ zfs create -o org.freebsd:swap=on -o checksum=off -V 2G pool0/swap
freenas ~/ root~$ swapon /dev/zvol/pool0/swap
swapon: /dev/zvol/pool0/swap: Operation not supported by device
freenas ~/ root~$ truss swapon /dev/zvol/pool0/swap
mmap(0x0,32768,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) = 34366136320 (0x80061a000)
issetugid(0x800819b80,0x7fffffffefd3,0x40,0x0,0xffff80080081abad,0x0) = 0 (0x0)
lstat("/etc",{ mode=dr-xr-xr-x ,inode=2,size=2560,blksize=4096 }) = 0 (0x0)
lstat("/etc/libmap.conf",{ mode=-rw-r--r-- ,inode=273,size=47,blksize=4096 }) = 0 (0x0)
open("/etc/libmap.conf",O_RDONLY,00) = 3 (0x3)
fstat(3,{ mode=-rw-r--r-- ,inode=273,size=47,blksize=4096 }) = 0 (0x0)