Skip to content

Instantly share code, notes, and snippets.

View bobjansen's full-sized avatar

Bob Jansen bobjansen

View GitHub Profile
#include <iostream>
using namespace std;
bool checkAddition(int y, int m, int d);
bool checkMultiply(int y, int m, int d);
bool checkDivision(int y, int m, int d);
bool checkSubstraction(int y, int m, int d);
bool checkAddition(int y, int m, int d) {
@bobjansen
bobjansen / echo.py
Created August 30, 2012 16:32
The main script for solving level8 of the Stripe CtF 2.0
#!/usr/bin/env python
"""
Finds chunks with some tweaking
"""
import socket
import helpers
from time import sleep
@bobjansen
bobjansen / nosetmacs.el
Created October 20, 2012 16:26
Run nosetests from any directory in your virtualenv (Windows compatible)
(defun run-tests ()
"Finds the virtualenv bin-dir and run nosetests"
(interactive)
(let ((bin-dir (if (eq system-type 'windows-nt) "Scripts" "bin"))
(cwd (reverse (split-string default-directory "/"))))
(let ((venv-dir (if (string= (first cwd) "")
(find-bin-dir (rest cwd) bin-dir)
(find-bin-dir cwd bin-dir))))
(if venv-dir
(let ((old-path (getenv "PATH")))
@bobjansen
bobjansen / example.cpp
Last active March 10, 2016 17:33
cpr Sessions, better response
// This is based on the example cpr project
/*
* My output was:
➜ build git:(master) ✗ ./example
elapsed time: 0.533153s
elapsed time: 0.537888s
elapsed time: 0.502068s
elapsed time: 0.122032s
elapsed time: 0.125355s
@bobjansen
bobjansen / plain_R.R
Last active June 8, 2019 12:29
FastR experiments with Sudoku code extracted (Rcpp ignored)
sudokuTxt <- "
1 0 0 0 0 0 0 0 6
0 0 6 0 2 0 7 0 0
7 8 9 4 5 0 1 0 3
0 0 0 8 0 7 0 0 4
0 0 0 0 3 0 0 0 0
0 9 0 0 0 4 2 0 1
3 1 2 9 7 0 0 4 0
@bobjansen
bobjansen / mesh_test.R
Created September 16, 2019 16:56
Mesh Test
# Rscript mesh <- test.R
# LD_PRELOAD=libmesh.so Rscript mesh_test.R
#library(data.table)
#library(microbenchmark)
doDataTable <- FALSE
pid <- Sys.getpid()
GetMemSize <- function() {
---
title: "Infinite(?) Knight Tour"
author: "Bob Jansen"
format: pdf
editor: visual
monofont: "Fira Code"
---
## Terminating Knight Tour on Infinite Boards
@bobjansen
bobjansen / Qmd
Last active May 27, 2023 16:47
Terminating Knight Tour on Infinite Boards
---
title: "Infinite(?) Knight Tour"
author: "Bob Jansen"
format: pdf
editor: visual
keep-tex: True
monofont: "Fira Code"
---
## Terminating Knight Tour on Infinite Boards
@bobjansen
bobjansen / main.py
Last active May 29, 2023 19:16
How to persist orders with minimum overhead?
"""
A simple experiment to time different ways to save orders
Start the servers with
> python main.py server 5
and start the experiment with
> python main.py client 5
Servers can be reused.
Example output:
Connecting to 5 exchanges with sync writer