Skip to content

Instantly share code, notes, and snippets.

@antoinebrl
antoinebrl / README.md
Last active April 21, 2024 08:59
Prepare ImageNet

Preparation of ImageNet (ILSVRC2012)

The dataset can be found on the official website if you are affiliated with a research organization. It is also available on Academic torrents.

This script extracts all the images and group them so that folders contain images that belong to the same class.

  1. Download the ILSVRC2012_img_train.tar and ILSVRC2012_img_val.tar
  2. Download the script wget https://gist.githubusercontent.com/antoinebrl/7d00d5cb6c95ef194c737392ef7e476a/raw/dc53ad5fcb69dcde2b3e0b9d6f8f99d000ead696/prepare.sh
  3. Run it ./prepare.sh
@mmozeiko
mmozeiko / go_aeshash.h
Created November 14, 2018 07:34
Go's AES-NI based hash
#include <stddef.h>
#include <stdint.h>
#include <intrin.h>
// see aeshashbody in https://github.com/golang/go/blob/master/src/runtime/asm_amd64.s
// this is initialized on process startup with random from system
static __declspec(align(16)) uint8_t aeskeysched[128];
static __declspec(align(16)) const uint8_t masks[16][16] =
@pklaus
pklaus / rpi3-arch-linux-to-sdcard.sh
Last active February 3, 2023 01:58
Raspberry Pi 3: Arch Linux ARM 64bit to SDcard Script. This is for the Rapsberry Pi 3. For the RPi 2 (or the 3 32bit), see https://gist.github.com/pklaus/9dd4a7bf040788cda501 . For the RPi 1, see https://gist.github.com/pklaus/b92dfc72136d1509c2ed .
#!/bin/bash
# <https://archlinuxarm.org/platforms/armv8/broadcom/raspberry-pi-3>
echo -e "\n\nArch Linux ARM to SD Card"
echo -e "For the Raspberry Pi 3, if you want to use the unofficial arm64 variant."
echo -e "(Otherwise use the Raspberry Pi 2 version of this script!)\n\n"
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
@neilpa
neilpa / CStringArray.swift
Last active August 7, 2020 02:24
Swift wrappers for C functions taking char** arguments
// Usage
let argv = CStringArray(["ls", "/"])
posix_spawnp(nil, argv.pointers[0], nil, nil, argv.pointers, nil)
// Is this really the best way to extend the lifetime of C-style strings? The lifetime
// of those passed to the String.withCString closure are only guaranteed valid during
// that call. Tried cheating this by returning the same C string from the closure but it
// gets dealloc'd almost immediately after the closure returns. This isn't terrible when
// dealing with a small number of constant C strings since you can nest closures. But
@willurd
willurd / web-servers.md
Last active May 17, 2024 16:24
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000