Skip to content

Instantly share code, notes, and snippets.

@holly
holly / bsd-install.sh
Last active April 23, 2017 03:08
freebsd auto installer
export ZFSBOOT_DISKS=ada0
export ZFSBOOT_POOL_CREATE_OPTIONS="-O compress=lz4 -O atime=off -O copies=2"
export nonInteractive="YES"
DISTRIBUTIONS="base.txz kernel.txz"
#!/bin/sh
sysrc ifconfig_em0="DHCP"
sysrc sshd_enable="YES"
sysrc hostname="localhost"
@holly
holly / mklibs.pl
Created May 2, 2017 17:17
freebsd make thinjail environment
#!/usr/bin/perl
# mklibs.pl
# by Manuel Kasper <mk@neon1.net>
#
# walks a tree and extracts library dependencies
# by using ldd
# outputs a list of all libraries required for those binaries,
# suitable for use with mkmini.pl
#
#!/usr/bin/env python3
# vim:fileencoding=utf-8
from datetime import datetime
from argparse import ArgumentParser, FileType
from concurrent.futures import ThreadPoolExecutor, as_completed
from subprocess import Popen, PIPE
import threading
import re
import shlex
import time
@holly
holly / css
Created February 17, 2018 11:26
Amazon Associates Link Builder
.aalb-110-product-carousel-unit {
/*Enable this border property to have a border around the ad unit*/
/*border: 1px solid #d4d4c4;*/
background: #ffffff;
}
/* Actual styles start below */
.aalb-110-product-carousel-unit {
position: relative;
overflow: hidden;
@holly
holly / psl.pl
Created December 27, 2018 08:39
public suffix from domain
#!/usr/bin/env perl
use strict;
use feature qw(say);
use autodie;
use LWP::UserAgent;
use HTTP::Request;
use File::Temp qw(tempfile);
use Getopt::Long qw(:config posix_default no_ignore_case gnu_compat);
@holly
holly / psl.py
Created December 27, 2018 14:06
public suffix from domain
#!/usr/bin/env python3
# vim:fileencoding=utf-8
""" [NAME] script or package easy description
[DESCRIPTION] script or package description
"""
from argparse import ArgumentParser
import tempfile
import re
@holly
holly / wp_delete_revisons.sql
Last active April 27, 2019 17:01
wp delete revision, auto-draft and trash
DELETE FROM wp_posts WHERE post_type = 'revision';
DELETE FROM wp_posts WHERE post_status IN ('auto-draft', 'trash');
DELETE FROM wp_postmeta WHERE NOT EXISTS (SELECT 'x' FROM wp_posts WHERE wp_posts.ID = wp_postmeta.post_id);
@holly
holly / smaps.py
Created February 11, 2019 15:36
read /proc/$pid/smaps
#!/usr/bin/env python
import sys
def read_smaps(pidlist):
try:
print("PID\tRSS\tSHARED\t\tNONE_SHARED")
mem = lambda t, f: int(f[1]) if f[0] == '%s:' % t else 0.0
for pid in pidlist:
filename = "/proc/%s/smaps" % pid
@holly
holly / 100-sysctl.conf
Last active July 19, 2021 13:56
sysctl tuning
#net.ipv4.ip_forward = 1
#net.ipv4.conf.all.forwarding=1
net.ipv6.conf.all.disable_ipv6=1
net.ipv6.conf.default.disable_ipv6=1
net.ipv6.conf.lo.disable_ipv6=1
# 共有メモリの最大サイズ。サーバーの搭載メモリ(1GB)に合わせて変更
##kernel.shmmax = 1073741824
# システム全体の共有メモリ・ページの最大数
##kernel.shmall = 262144
# システム全体のプロセス数の上限