Skip to content

Instantly share code, notes, and snippets.

@shakesoda
shakesoda / timer.h
Last active October 25, 2015 21:16
simple high resolution timer w/SDL2
/* USAGE:
* Timer foo; // Start the timer
* const TimeData &time = foo.touch(); // Update and return TimeData (delta being the time since last touch)
* const TimeData &time_peek = foo.peek(); // returns current TimeData only updating the current time (does not reset!)
* SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION
*
* I haven't actually tested peek, but it looks right... */
#pragma once
#include <SDL.h>
@willurd
willurd / web-servers.md
Last active November 10, 2025 16:13
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

These are only examples, for a few very common actions. You are expected to write your own rules for the rest. The syntax is regular JavaScript, but see the polkit(8) manpage for the object structure and available API. These examples are for polkit versions 106 and later, with the JS interpreter. They won't work with Debian's polkit v105.

  • If you don't know the action name, either run pkaction and look for anything similar:

    pkaction | grep cups
    

    ...or try to perform the actual action, cancel it, then look in your system logs:

    journalctl -t polkitd -n 10 | grep action