Skip to content

Instantly share code, notes, and snippets.

@oakwhiz
oakwhiz / dirtree-compare.sh
Last active August 29, 2015 14:04
Bash script to compare two directory trees without comparing the files
find "$2" -type d -printf "%P\n" | sort | diff - <(find "$1" -type d -printf "%P\n" | sort)
@oakwhiz
oakwhiz / ofed.conf
Created June 4, 2014 00:39
ofed.conf that fixes "Failed to build compat-rdma RPM"
#compat-rdma=y
#compat-rdma-devel=y
libibverbs=y
libibverbs-devel=y
libibverbs-devel-static=y
libibverbs-utils=y
libibverbs-debuginfo=y
libmthca=y
libmthca-devel-static=y
libmthca-debuginfo=y
@oakwhiz
oakwhiz / opensmd.sh
Last active August 29, 2015 14:02
opensm initscript (fixed for systemd)
#!/bin/bash
#
# Bring up/down opensm (script fixed for systemd)
#
# chkconfig: - 15 85
# description: Activates/Deactivates InfiniBand Subnet Manager
#
### BEGIN INIT INFO
# Provides: opensm
# Required-Start: $syslog openibd $local_fs
@oakwhiz
oakwhiz / configure-crond-journal.md
Last active November 9, 2023 06:47
How to configure crond to send cron job output to the system journal

How to configure crond to send cron job output to the system journal

Keywords: fedora 20, systemd, cron, crond, output, stdout, journal

Problem: You want to capture and read the output of your cron jobs, but the output isn't being logged anywhere.

Solution: Add an argument to crond.

@oakwhiz
oakwhiz / gigabyte-via-usb-linux-iommu.md
Created May 20, 2014 05:17
Problem with VIA USB controller in Linux on Gigabyte motherboards

Gigabyte GA-990FXA-UD3 revision 4.0

IOMMU enabled

Linux 3.13

Problem:

VIA USB 3.0 controller doesn't work in Linux. The AMD IOMMU is enabled in the BIOS. Checking kernel messages (dmesg) shows that the USB controller is shut down due to an error, and there are also many error messages pertaining to AMD-Vi and access to a certain memory address through the IOMMU. Some USB ports do not work.

template <class <typename> F>
struct Functor : private Applicative<F> {
template <typename T, typename Function>
static F<T> fmap(Function&& f, F<T> x) {
return ap(pure(move(f)), move(x));
}
};
template <class <typename> M>
struct Applicative<M> : private Monad<M> {
@oakwhiz
oakwhiz / MorseDecoder
Created May 3, 2014 23:13
Program to exhaustively decode Morse Code that is missing delimiting spaces.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace MorseDecoder
{
class Program
@oakwhiz
oakwhiz / VMFParser.scala
Created February 24, 2014 00:08
VMF (Valve Map Format) Hammer save file parser written in Scala using parser combinators.
import scala.util.parsing.combinator.RegexParsers
object Main {
val testdata = """versioninfo
{
"editorversion" "400"
"editorbuild" "5704"
"mapversion" "3656"
"formatversion" "100"
"prefab" "0"
@oakwhiz
oakwhiz / pyglet-test
Created March 23, 2013 08:54
Renders triangles in increasing number until fps drops too much
from __future__ import division
from random import uniform
from pyglet import clock, font, image, window
from pyglet.gl import *
class glBeginEnd:
def __init__(self, gl_enum):
self.gl_enum = gl_enum
def __enter__(self):