Skip to content

Instantly share code, notes, and snippets.

View UlasSAYGINIM's full-sized avatar

Ulaş SAYGIN UlasSAYGINIM

View GitHub Profile
@julp
julp / binjail.sh
Created August 29, 2016 16:34
[FreeBSD] Create or update jails
#!/bin/sh
set -e
FROM="binaries"
# use vnet ? Default: use if available
VNET=`sysctl -n kern.features.vimage`
MIRROR="ftp.freebsd.org/pub/FreeBSD/releases/"
# default cache directory
@faberyx
faberyx / c++ daemon
Last active December 21, 2021 19:59
#include <stdio.h>
#include <signal.h>
#include <syslog.h>
#include <errno.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
@soffes
soffes / WebCredential.swift
Last active November 25, 2022 08:24
Easily access Shared Web Credentials
import Foundation
import Security
struct SharedWebCredentials {
// MARK: - Types
struct Credential {
let domain: String
let account: String
@ammario
ammario / ipint.go
Last active February 7, 2025 05:24
Golang IP <-> int conversion
func ip2int(ip net.IP) uint32 {
if len(ip) == 16 {
return binary.BigEndian.Uint32(ip[12:16])
}
return binary.BigEndian.Uint32(ip)
}
func int2ip(nn uint32) net.IP {
ip := make(net.IP, 4)
binary.BigEndian.PutUint32(ip, nn)
@will118
will118 / jails.md
Last active October 27, 2019 08:42
freebsd zfs jails

#Jails

Setup network

# /etc/rc.conf

pf_enable="YES"

cloned_interfaces="lo1"
ifconfig_lo1="inet 172.16.1.1 netmask 255.255.255.0"
@zg
zg / freebsd-qemu-xhyve-mac-os-x-virtual-machine.md
Last active March 22, 2025 20:32
Create FreeBSD virtual machine using qemu. Run the VM using xhyve.

TL;DR

  • Create 10GB FreeBSD image using QEMU.
  • Run the VM using xhyve.
  • Mount host directory.
  • Resize the image.

Requisites

This is an outdated draft that was used to review the content with FreeBSD contributors. For the latest revision, vist http://shawndebnath.com/articles/2016/03/27/freebsd-jails-with-vlan-howto.html.


FreeBSD Jails with VLAN HOWTO

This article discusses how to set up jails on a FreeBSD 11-CURRENT system utilizing VIMAGE (aka VNET) to provide a virtualized independent network stack for each jail with support for VLAN tagging.

Prerequisites

@SumiTomohiko
SumiTomohiko / kqueue_daemon.c
Last active May 21, 2020 13:46
Simple daemon example using kqueue
/*
* This is public domain.
*/
#include <sys/types.h>
#include <sys/event.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <errno.h>
#include <libgen.h>
#include <netinet/in.h>
@cyrusboadway
cyrusboadway / google-domains-dynamic-dns-update.sh
Created February 20, 2016 17:21
Script to update a Google Domains DNS record
#!/bin/bash
### Google Domains provides an API to update a DNS "Syntheitc record". This script
### updates a record with the script-runner's public IP, as resolved using a DNS
### lookup.
###
### Google Dynamic DNS: https://support.google.com/domains/answer/6147083
### Synthetic Records: https://support.google.com/domains/answer/6069273
USERNAME=""
@jahil
jahil / sysctl.conf
Created January 13, 2016 15:32
calomel.org freebsd network tuning
# FreeBSD 10.2 -- /etc/sysctl.conf version 0.47
# https://calomel.org/freebsd_network_tuning.html
#
# low latency is important so we highly recommend that you disable hyper
# threading on Intel CPUs as it has an unpredictable affect on latency, cpu
# cache misses and load.
#
# These settings are specifically tuned for a "low" latency FIOS (300/300) and
# gigabit LAN connections. If you have 10gig or 40gig you will need to increase
# the network buffers as proposed. "man tuning" for more information.