Skip to content

Instantly share code, notes, and snippets.

View ubergeek42's full-sized avatar

Keith Johnson ubergeek42

  • Rainforest QA
  • Greenville, SC
View GitHub Profile
@ubergeek42
ubergeek42 / Readme.md
Created February 17, 2024 17:05
USB Drive Imaging Tools for ICPC Contests

Warning: I've done no testing of this script on anything other than my own machine. Take care when running these scripts, as they can result in wiping the wrong disk if you are not careful. You've been warned.

Imaging Guide

To speed up imaging of disks instead of using dd and copying the whole thing (including blocks that are just full of zeroes), we can use partclone to be more intelligent about things. This is a two step process, first we must prepare the image to something partclone knows how to use, and then we can restore it to our disks.

Prerequisites

apt-get install partclone fdisk mount
@ubergeek42
ubergeek42 / Readme.md
Last active April 20, 2022 17:03
ICPC Proxied Network Access

ICPC Proxied Network Access

This is the method we've used at the ICPC SouthEast USA regional contest for years.

The basic idea:

  • Run squid as a proxy locally on each machine
  • Configure squid (using squidGuard) to only allow allow access to certain domains
    • Technically this can support specific URLs on a given domain, but I don't think that works with https
  • Configure UFW firewall to only allow network access through the proxy
  • Configure a local webserver to serve up a "block" page whenever a user tries to access something they shouldn't
@ubergeek42
ubergeek42 / patch.diff
Created October 17, 2018 22:34
maybe fixes the charts?
diff --git a/webapp/src/DOMJudgeBundle/Resources/views/jury/partials/submission_graph.html.twig b/webapp/src/DOMJudgeBundle/Resources/views/jury/partials/submission_graph.html.twig
index 94e688f..0fa0b84 100644
--- a/webapp/src/DOMJudgeBundle/Resources/views/jury/partials/submission_graph.html.twig
+++ b/webapp/src/DOMJudgeBundle/Resources/views/jury/partials/submission_graph.html.twig
@@ -68,6 +68,7 @@ $(function(){
y2: 15 + chart.yAxis.scale()({{timelimit}}),
})
.style("stroke", "#F00");
+ chart.update();
nv.utils.windowResize(chart.update);
public class StackTest implements Runnable {
public static long level = 0;
public static long stacksize = 1<<28;
public static long num(int n) {
level++;
return n==0 ? 0 : 1+num(n-1);
}
public void run() {
level = 0;
### Keybase proof
I hereby claim:
* I am ubergeek42 on github.
* I am ubergeek42 (https://keybase.io/ubergeek42) on keybase.
* I have a public key ASCrRBCnwheYH6fveH8exhiyzLlqABDjI9qpffsngGtN9wo
To claim this, I am signing this object:
@ubergeek42
ubergeek42 / readwrite-splice.patch
Created May 30, 2016 03:00
Use splice() instead of read/write
commit 93c82634c1218feb191efcf64565582e97dd0fc5
Author: Keith Johnson <kj@ubergeek42.com>
Date: Sun May 29 23:00:08 2016 -0400
Use splice() instead of read()/write() in runguard
diff --git a/judge/runguard.c b/judge/runguard.c
index d0154c4..4ca6a9b 100644
--- a/judge/runguard.c
+++ b/judge/runguard.c
@ubergeek42
ubergeek42 / archive_pdf.ps1
Last active October 31, 2023 19:52
Powershell print logging
# Printer *MUST* be configured to "Store print jobs". This script will delete them later.
# Trigger this script on event 307 and pass in the 5 variables below(See the xml file here for the task scheduler definition)
#
# JOBID formatted as 5 digit number
#create c:\scripts\tmp\JOBID_DIR
$JOBID=$args[0]
$TIMESTAMP=$args[1]
$USER=$args[2]
$PRINTER=$args[3]
$DOCTITLE=$args[4]
@ubergeek42
ubergeek42 / gist:a904258d48f480b13cf9
Last active January 8, 2016 02:21
coverletter-ops-engineer

Hi! My name is Keith Johnson, and I'd like to apply for your operations engineer position. I was referred to this job posting by one of your employees, and it seems like the perfect fit! Mozilla seems like a great place to work; when I work on side projects I always try to make them open source, and Mozilla's commitment to open source has always made me happy. I'm glad that you're all working to make the web a better place and I'd love to do my part.

My day to day job has been as a sysadmin for a university department, with the freedom to work with whatever technologies might benefit our students or faculty. I automated most of our infrastructure using ansible(previously chef and puppet) and have done a few projects working with Amazon Web Services. I have a passion for scripting and automation and find it to be a ton of fun. Not to mention I'm a quick learner and can wrap my head around a project rather fast and jump right in. Build tools and processes come naturally to me.

I'm hoping to work remotely from

@ubergeek42
ubergeek42 / dj-autologin.md
Created October 23, 2015 20:19
DOMjudge Automatic Login While Hiding the Credentials

For the Southeast Regional Programming competition we use DOMjudge with PHP_SESSION based authentication. Our contest is multi site over the internet, and there are no known ip ranges or anything we could use other than regular logins. Problem is we can't give out the credentials to the teams since they'd then have an easier time sharing accounts.

In the past this has meant we needed volunteers to go around to the team computers and manually log each team in at the beginning of the practice round, and again after the computers have been cleaned at the beginning of the real contest. This is just annoying, and can take a fair amount of time I'd rather spend fixing other

@ubergeek42
ubergeek42 / fix-runguard.diff
Created May 19, 2014 17:15
protect against forksbombs and friends in runguard
diff --git a/judge/runguard.c b/judge/runguard.c
index 84d7f40..2cb28c1 100644
--- a/judge/runguard.c
+++ b/judge/runguard.c
@@ -462,6 +462,21 @@ void cgroup_attach()
cgroup_free(&cg);
}
+void cgroup_kill()
+{