Skip to content

Instantly share code, notes, and snippets.

@johnko
johnko / gist:5201785
Last active December 15, 2015 04:29
RedditQuickPreview After loading the script, opens a frame or window when you hover over links. Exclusions are in regex. Usage: - Make a bookmark with code, with a prefix of "javascript:". So your bookmark will look like "javascript:(function....." - Click that bookmark whenever you want to load the script.
(
function () {
"use strict";
/*global window, document, self*/
var type = "window", /*frame or window*/
exclude = /(pixel.reddit|irc:\/\/|reddit.com\/domain|\/compose|\/login|\/submit|\/password|\/gold|reddit.com\/user|reddit.com\/r\/[^\/]*\/?$)/i,
a = document.getElementsByTagName("a"),
myrdiv = document.createElement("div"),
myrframe = document.createElement("iframe"),
i = 0;

Add the following chunk to your existing ISC dhcpd.conf file.

if exists user-class and ( option user-class = "iPXE" ) {
    filename "http://boot.smidsrod.lan/bootstrap.ipxe";
}
else {
    filename "undionly.kpxe";
}

(or see https://gist.github.com/4008017 for a more elaborate setup

@johnko
johnko / neat bookmarks
Created August 18, 2013 16:52
neat bookmarks
http://support.apple.com/kb/ht1533
stickyjs.com
webdesignledger.com/tips/color-links-books-tools-to-make-your-life-easier
webdesignledger.com/tools/9-jquery-plugins-for-improving-website-navigation
areuswade.com/precomposed-touch-gestures/
@johnko
johnko / ttc2ttf.py
Created September 4, 2013 21:01 — forked from kayahr/ttc2ttf.py
ttc2ttf
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#First released as C++ program by Hiroyuki Tsutsumi as part of the free software suite “Beer”
#I thought porting it to Python could be both a challenge and useful
from sys import argv, exit, getsizeof
from struct import pack_into, unpack_from
def ceil4(n):

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@johnko
johnko / Percona XtraDB Cluster on FreeBSD 10
Last active August 29, 2015 14:01
These were my error logs. but it turns out Line 4 of var-log-mysql-error2.log was the hint I needed to get this working. /server/mysql/data/wsrep_recovery.lBRkgo could not be created because galera could not write to that directory
# grep mysql /etc/rc.conf
mysql_limits="YES"
mysql_dbdir="/server/mysql/data"
mysql_optfile="/server/mysql/my.cnf"
mysql_enable="YES"
mysql_args=""
@johnko
johnko / test.sh
Last active August 29, 2015 14:02
Testing FreeBSD ZFS... Also, how to create millions of files... CAUTION, ONLY DO THIS ON A TEST SYSTEM
#!/bin/sh
#########################################
# CAUTION, ONLY DO THIS ON A TEST SYSTEM
#########################################
# use GELI to onetime encrypt 4 hard drives to test with
for i in `seq 0 3` ; do geli onetime /dev/ada$i ; done
# append the ELI devices to a DEV variable
@johnko
johnko / gist:66515a2db2aa22aa51bd
Last active May 6, 2024 09:31
How to iPXE boot from http iso on www.vultr.com

If your custom iso is not mounting, and your console is at an iPXE shell, you can:

initrd http://mfsbsd.vx.sk/files/iso/10/amd64/mfsbsd-se-10.1-RELEASE-amd64.iso

While the iso is downloading, vultr's iPXE does not include memdisk, so we have to upload it ourselves to another host.

Here's one I found public, though I wouldn't recommend using it: http://preseed.panticz.de/ipxe/memdisk

var keymap = {
'0': 48,
'1': 49,
'2': 50,
'3': 51,
'4': 52,
'5': 53,
'6': 54,
'7': 55,
'8': 56,
@johnko
johnko / ssh-multi.sh
Last active July 28, 2022 15:34 — forked from dmytro/ssh-multi.sh
a script to ssh multiple servers over multiple tmux panes
#!/bin/sh
# ssh-multi
# D.Kovalov
# Based on http://linuxpixies.blogspot.jp/2011/06/tmux-copy-mode-and-how-to-control.html
# Modified by johnko https://gist.github.com/johnko/a8481db6a83ec5ea2f37
# a script to ssh multiple servers over multiple tmux panes
starttmux() {