Skip to content

Instantly share code, notes, and snippets.

@plentz
plentz / nginx.conf
Last active June 11, 2024 06:55
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@robert-wallis
robert-wallis / capture.cpp
Created March 1, 2013 08:43
Capture the raw screen pixels in OSX. Then saves to a file for debugging.
void captureScreen()
{
CGImageRef image_ref = CGDisplayCreateImage(CGMainDisplayID());
CGDataProviderRef provider = CGImageGetDataProvider(image_ref);
CFDataRef dataref = CGDataProviderCopyData(provider);
size_t width, height;
width = CGImageGetWidth(image_ref);
height = CGImageGetHeight(image_ref);
size_t bpp = CGImageGetBitsPerPixel(image_ref) / 8;
uint8 *pixels = malloc(width * height * bpp);