Skip to content

Instantly share code, notes, and snippets.

@facboy
facboy / kernel.log
Created November 14, 2020 14:40
OpenVPN with NSS R7800 kernel log - no eth0
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 5.4.75 (chrisng@xubuntu-vbox) (gcc version 8.4.0 (OpenWrt GCC 8.4.0 r12771-43e31bae67)) #0 SMP Sat Nov 14 11:57:26 2020
[ 0.000000] CPU: ARMv7 Processor [512f04d0] revision 0 (ARMv7), cr=10c5787d
[ 0.000000] CPU: div instructions available: patching division code
[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, PIPT instruction cache
[ 0.000000] OF: fdt: Machine model: Netgear Nighthawk X4S R7800
[ 0.000000] Memory policy: Data cache writealloc
[ 0.000000] On node 0 totalpages: 122880
[ 0.000000] Normal zone: 1080 pages used for memmap
[ 0.000000] Normal zone: 0 pages reserved
@facboy
facboy / 20-smp-tune
Created February 27, 2020 23:09
20-smp-tune
#!/bin/sh
[ "$ACTION" = add ] || exit
NPROCS="$(grep -c "^processor.*:" /proc/cpuinfo)"
[ "$NPROCS" -gt 1 ] || exit
PROC_MASK="$(( (1 << $NPROCS) - 1 ))"
function parse_env() {
@facboy
facboy / README.md
Last active September 7, 2019 10:46
mbw
#
# Default PF configuration file.
#
# This file contains the main ruleset, which gets automatically loaded
# at startup. PF will not be automatically enabled, however. Instead,
# each component which utilizes PF is responsible for enabling and disabling
# PF via -E and -X as documented in pfctl(8). That will ensure that PF
# is disabled only when the last enable reference is released.
#
# Care must be taken to ensure that the main ruleset does not get flushed,
@facboy
facboy / ps1.bashrc
Last active November 9, 2017 17:51
PS1 fun
__set_ps1() {
local RCol='\[\e[0m\]'
local SetTitle='\[\033]0;\u@\h:\w\007\]'
PS1="\t \[\$(__exit_col)\]\$?${RCol}\n[\\u@\\h \\W]$ ${SetTitle}"
unset PROMPT_COMMAND
}
__set_ps1
local lgi = require('lgi')
local GLib = lgi.require('GLib')
hexchat.register('Playback', '1', "Integration with ZNC's Playback module")
--[[
This should behave like this:
On connect (end of MOTD):
if new server, play all
[
{"name": "Afghanistan", "code": "AF"},
{"name": "Åland Islands", "code": "AX"},
{"name": "Albania", "code": "AL"},
{"name": "Algeria", "code": "DZ"},
{"name": "American Samoa", "code": "AS"},
{"name": "Andorra", "code": "AD"},
{"name": "Angola", "code": "AO"},
{"name": "Anguilla", "code": "AI"},
{"name": "Antarctica", "code": "AQ"},
@facboy
facboy / CheckpointBug.java
Created November 19, 2014 12:12
ClassCastException from JavaPairRDD.collectAsMap()
package org.facboy.spark;
import org.apache.spark.SparkConf;
import org.apache.spark.api.java.JavaPairRDD;
import org.apache.spark.api.java.JavaRDD;
import org.apache.spark.api.java.JavaSparkContext;
import scala.Tuple2;
import scala.reflect.ClassTag;
import scala.reflect.ClassTag$;
@facboy
facboy / centos_javaalternatives.py
Last active August 29, 2015 14:06
Small python script to run update-alternatives (on Debian) or alternatives (on CentOS) for Oracle JDK's java and javac. Correctly updates all the man paths etc. Assumes JDKs are installed in /opt/java/ on Debian, or /usr/java/ on CentOS (which is where the RPMs install it).
#!/usr/bin/python
from __future__ import print_function
import os
import subprocess
import sys
def main():
if len(sys.argv) != 3:
@facboy
facboy / ProxifierPerformance.java
Created August 15, 2011 19:24 — forked from garcia-jj/ProxifierPerformance.java
cglib vs javassist performance tests
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.concurrent.Callable;
import javassist.util.proxy.MethodHandler;
import javassist.util.proxy.ProxyFactory;
import javassist.util.proxy.ProxyObject;
import net.sf.cglib.proxy.Enhancer;
import net.sf.cglib.proxy.MethodInterceptor;