Skip to content

Instantly share code, notes, and snippets.

View vmrob's full-sized avatar

Victor Robertson vmrob

  • Cruise Automation
  • San Francisco
View GitHub Profile
@vmrob
vmrob / needy.jam
Last active September 22, 2015 02:55
needy b2
#################
# Needy toolset
#################
import type ;
import feature ;
import toolset ;
import generators ;
type.register NEEDSFILE : json ;
@vmrob
vmrob / cache.cpp
Last active August 29, 2015 14:28
Testing some policy-based design
#include <unordered_map>
#include <type_traits>
#include <string>
#include <queue>
#include <unordered_set>
#include <utility>
class PolicyBase {
public:
template <typename CacheType>
@vmrob
vmrob / generate-gitdag.sh
Created May 13, 2015 03:45
Script to convert a pdf to png
#!/bin/bash -e
Root=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
if [[ $1 == "" ]] ; then
echo "usage: generate-gitdag.sh input.tex [density (default 300)]"
exit;
fi
Density=300
@vmrob
vmrob / padding.cpp
Created January 26, 2015 19:08
Arbitrary byte padding with C++ TMP
#include <type_traits>
template <typename T, size_t Amount, typename = void>
struct PaddedValImpl {
PaddedValImpl(T&& t) : val(std::forward<T>(t)) {}
T val;
};
template <typename T, size_t Amount>
struct PaddedValImpl <T, Amount
@vmrob
vmrob / mem_function_traits.cpp
Last active June 13, 2020 01:35
Member Function Traits
#include <utility>
#include <functional>
#include <type_traits>
#include <typeinfo>
#include <iostream>
namespace meta {
// detects callable objects, not functions
@vmrob
vmrob / test.cpp
Created August 14, 2014 20:01
test
#include <iostream>
#include <thread>
#include <vector>
#include <random>
#define NUM_THREADS 10
#define GOAL 2147000000 // 2147483647 is max
typedef int32_t random_type;
@vmrob
vmrob / convert.sh
Created June 18, 2014 22:03
Converts a video to a gif
#!/bin/bash -e
# Converts a video to a gif
if [ "$#" -ne 2 ]; then
echo "usage: ${0##*/} [input video] [output gif]"
exit 1
fi
VIDEO=$1
@vmrob
vmrob / math-se-612346.c
Last active August 29, 2015 14:00
Brute force test for Math StackExchange question 612346: http://math.stackexchange.com/questions/612346/
// This program is a quick brute force test of the question described at
// http://math.stackexchange.com/questions/612346/find-all-positive-integers-n-s-t-3n-5n-is-divisible-by-n2-1
// Copyright (C) 2014 Victor Robertson
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
@vmrob
vmrob / remove_debris.py
Created April 19, 2014 05:22
Script for space engineers to remove debris
# The MIT License (MIT)
#
# Copyright (c) 2014 Victor Robertson
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@vmrob
vmrob / count_objects.py
Created April 15, 2014 22:19
count objects script for space engineers game
# The MIT License (MIT)
#
# Copyright (c) 2014 Victor Robertson
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions: