Skip to content

Instantly share code, notes, and snippets.

@alexzzhu
alexzzhu / kalibr_to_ros_cinfo.py
Created March 20, 2018 17:40
Python script to generate ROS format yaml files from the output of Kalibr. Also useful to compute rectification and projection matrices with OpenCV.
#!/usr/bin/env python
import numpy as np
import cv2
import argparse
import ruamel.yaml
def main():
parser = argparse.ArgumentParser(description="Converts a cam info in kalibr yaml format to the expected ROS format for camera_info_manager.")
parser.add_argument("--camchain", dest="camchain",
help="Camchain yaml file with camera info.",
@shafik
shafik / WhatIsStrictAliasingAndWhyDoWeCare.md
Last active April 26, 2025 00:19
What is Strict Aliasing and Why do we Care?

What is the Strict Aliasing Rule and Why do we care?

(OR Type Punning, Undefined Behavior and Alignment, Oh My!)

What is strict aliasing? First we will describe what is aliasing and then we can learn what being strict about it means.

In C and C++ aliasing has to do with what expression types we are allowed to access stored values through. In both C and C++ the standard specifies which expression types are allowed to alias which types. The compiler and optimizer are allowed to assume we follow the aliasing rules strictly, hence the term strict aliasing rule. If we attempt to access a value using a type not allowed it is classified as undefined behavior(UB). Once we have undefined behavior all bets are off, the results of our program are no longer reliable.

Unfortunately with strict aliasing violations, we will often obtain the results we expect, leaving the possibility the a future version of a compiler with a new optimization will break code we th

@Erotemic
Erotemic / bench.py
Created February 5, 2018 03:28
benchmark code
import ubelt as ub
import numpy as np
from PIL import Image
import six
import cv2
from clab.augment import augment_common
from clab.util import imutil
from clab import util
try:
import skimage
@mbinna
mbinna / effective_modern_cmake.md
Last active April 25, 2025 22:01
Effective Modern CMake

Effective Modern CMake

Getting Started

For a brief user-level introduction to CMake, watch C++ Weekly, Episode 78, Intro to CMake by Jason Turner. LLVM’s CMake Primer provides a good high-level introduction to the CMake syntax. Go read it now.

After that, watch Mathieu Ropert’s CppCon 2017 talk Using Modern CMake Patterns to Enforce a Good Modular Design (slides). It provides a thorough explanation of what modern CMake is and why it is so much better than “old school” CMake. The modular design ideas in this talk are based on the book [Large-Scale C++ Software Design](https://www.amazon.de/Large-Scale-Soft

const util = require('ethereumjs-util')
const Wallet = require('ethereumjs-wallet')
var possible = 'abcdef1234567890'
var basePrivateKey = '1cd3b30424316919712c48359829787eefa0d724a78274a506530dbb72'
var charsMissing = 64 - basePrivateKey.length
var targetPublicAddress = ' 0xe8Ca70C909905Ebbbe6a49c34797beF31d895241'
var missingPart = '';
for (var i = 0; i < charsMissing; i++) {
missingPart = missingPart.concat('f');
@pachadotdev
pachadotdev / 00-install-intel-mkl-64bit
Last active February 4, 2021 07:59
Install Intel MKL (64 bit) on Ubuntu 17.10
# Option 1: Use apt-get
# keys taken from https://software.intel.com/en-us/articles/installing-intel-free-libs-and-python-apt-repo
cd ~/GitHub/r-with-intel-mkl/
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB
apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB
sudo sh -c 'echo deb https://apt.repos.intel.com/mkl all main > /etc/apt/sources.list.d/intel-mkl.list'
sudo apt-get update && sudo apt-get install intel-mkl-64bit
@brian-armstrong-discord
brian-armstrong-discord / lilliput-bench.txt
Created November 7, 2017 19:59
Lilliput vs. Pillow-simd
Setup: Intel Haswell, Debian. Both tests ran against the same image libraries (libjpeg-turbo etc).
Both ran on a single thread only. Save qualities were 85 for JPEG and WEBP, compress level 7 for PNG.
Both tests ran many iterations and then averaged results.
Benchmarking code can be found at https://github.com/discordapp/lilliput-bench
Test types:
- Header reading: We don't actually know what's in a blob of image bytes when we get it. Reading the header allows us
to decide if we want to resize the image.
- Resize, 256x256 => 32x32: We have lots of icon-sized assets that we need resized into various smaller formats.
These make up a pretty sizable percentage of our resizes.
@sebasten
sebasten / trailersE32017alphasort.md
Last active August 12, 2019 22:52
Videos E3 2017 (ordre alphabétique)