Skip to content

Instantly share code, notes, and snippets.

@wspurgin
wspurgin / benchmark_json_parsing.rb
Created April 12, 2022 21:19
Simple benchmark comparing Oj and JSON::Ext (core ruby)
#! /usr/env ruby
require "benchmark"
require "oj"
require "json"
require "rbconfig"
puts "Host OS: #{RbConfig::CONFIG['host_os']}"
puts "Ruby Version #{RUBY_VERSION}"
puts "OJ version #{Oj::VERSION}"
@wspurgin
wspurgin / mounting-hd-ubuntu.md
Last active April 4, 2016 14:31
How to mount a hard drive on Ubuntu (and most Linux systems)

Mounting a hard drive on Ubuntu (and most Linux distros)

Note:

If you're adding a partition with an existing file structure that you don't want to delete, skip steps 1 and 2 as the partitions will already be created. If you're mounting a partition to replace your encrypted home directory, then see the Sources tab for the Help Ubuntu link where you can find a section on how to re-encrypt your home directory files.

Create a new partition with fdisk

  • Ex: sudo fdisk /dev/sdb (creates sdb1)

Give the partition a file system with mkfs-ext4

  • Ex: sudo mkfs-ext4 /dev/sbd1
@wspurgin
wspurgin / wikibooksplitter.pl
Created April 2, 2015 16:33
Wikisplitter for SMUCSE2341 by Chris Ayala and Will Spurgin
#! /usr/bin/env perl -w
if ($#ARGV == -1) {
$outputString = "\nUsage: wikibooksplitter.pl <WikiDump File> [Pages per file] [Max Files] [Output Directory]\n";
$outputString .= "\tWikiDump File: The path and name of the WikiDump File\n";
$outputString .= "\tPages Per File: The number of <page> documents per file (default = 1000)\n";
$outputString .= "\tMax Files: The maximum number of files to generate (default = as many as necessary to run through the input file)\n\n";
die $outputString;
}
my $maxFiles = 1000;