Skip to content

Instantly share code, notes, and snippets.

Twisting Pool Queue

by Leonard Ritter leonard.ritter@duangle.com, 2019-05-12

An implementation written in Scopes can be found here

We have the task of distributing IDs to objects in a pool that we can use to look up their contents. We want to ensure that:

  • Insert, access, and remove are operations with O(1) complexity.
  • The object array is compact, i.e. without any gaps, so we can parallelize work on it with full occupancy.
@olihawkins
olihawkins / planets.py
Created February 10, 2019 15:18
Python module for downloading planetary data for More or Less
# -*- coding: utf-8 -*-
"""
This is the Python module I used for scraping planetary data for the BBC radio
programme More or Less. You can read more about it here:
http://olihawkins.com/2019/02/1
"""
@chriskyfung
chriskyfung / fblink_mobile2desktop.user.js
Last active September 2, 2023 11:03
User script to automatically redirect a Facebook mobile link to a desktop version on Chrome and Firefox with Tampermonkey

why doesn't radfft support AVX on PC?

So there's two separate issues here: using instructions added in AVX and using 256-bit wide vectors. The former turns out to be much easier than the latter for our use case.

Problem number 1 was that you positively need to put AVX code in a separate file with different compiler settings (/arch:AVX for VC++, -mavx for GCC/Clang) that make all SSE code emitted also use VEX encoding, and at the time radfft was written there was no way in CDep to set compiler flags for just one file, just for the overall build.

[There's the GCC "target" annotations on individual funcs, which in principle fix this, but I ran into nasty problems with this for several compiler versions, and VC++ has no equivalent, so we're not currently using that and just sticking with different compilation units.]

The other issue is to do with CPU power management.

@andyrbell
andyrbell / scanner.sh
Last active July 9, 2024 16:43
Make a pdf look scanned using ImageMagick
# use ImageMagick convert
# the order is important. the density argument applies to input.pdf and resize and rotate to output.pdf
convert -density 90 input.pdf -rotate 0.5 -attenuate 0.2 +noise Multiplicative -colorspace Gray output.pdf
@scottwalters
scottwalters / Combat (1977) (Atari) (4K) [a].png
Last active October 10, 2018 08:53
Slides from YAPC::NA 2014 talk, Programming the Atari 2600
Combat (1977) (Atari) (4K) [a].png