Skip to content

Instantly share code, notes, and snippets.

@ruby0x1
ruby0x1 / hash_fnv1a.h
Last active May 29, 2024 17:19
FNV1a c++11 constexpr compile time hash functions, 32 and 64 bit
#pragma once
#include <stdint.h>
//fnv1a 32 and 64 bit hash functions
// key is the data to hash, len is the size of the data (or how much of it to hash against)
// code license: public domain or equivalent
// post: https://notes.underscorediscovery.com/constexpr-fnv1a/
inline const uint32_t hash_32_fnv1a(const void* key, const uint32_t len) {
@davestevens
davestevens / LetsEncrypt.md
Last active March 28, 2024 10:35
Let’s Encrypt setup for Apache, NGINX & Node.js

Let's Encrypt

Examples of getting certificates from Let's Encrypt working on Apache, NGINX and Node.js servers.

Obtain certificates

I chose to use the manual method, you have to make a file available to verify you own the domain. Follow the commands from running

git clone https://github.com/letsencrypt/letsencrypt
cd letsencrypt
@drewsberry
drewsberry / UE4-build.bat
Last active February 21, 2024 07:33
UE4 Windows command line building
:: Build client
RunUAT BuildCookRun -project="full_path.uproject"^
-noP4 -platform=Win64^
-clientconfig=Development -serverconfig=Development^
-cook -allmaps -build -stage^
-pak -archive -archivedirectory="Output Directory"
:: Cook client
RunUAT BuildCookRun -project="full_project_path_and_project_name".uproject^
-noP4 -platform=Win64^
@dirkk0
dirkk0 / main.cpp
Last active August 3, 2023 23:08
Basic SDL2 OpenGL application
// code nicked mainly from here:
// http://lazyfoo.net/tutorials/SDL/50_SDL_and_opengl_2/index.php
/* to compile
### installation on ubuntu
# install compiler etc
sudo apt-get install --yes software-properties-common g++ make
# install sdl2
@Eiyeron
Eiyeron / Rotscale.lua
Created April 22, 2015 20:12
Rotoscale
-- rotoscale!
-- by eiyeron
-- 07/04/2015
-- a good old demo effect! :3
-- retroactive.me/retro-actif
-- thanks zep for everything!:)
-- for pico-8, the code and
-- voxatron!
-- iirc local vars are faster
local t, angle, scale = 0, 0, 1
#include <iostream>
#include <type_traits>
/**
* Property template encapsulates the callback
* functions to getter and setter of the property.
* it does not store the propertyu value itself
*/
template<typename T, class U, T(U::*getter_fn)(), void(U::*setter_fn)(T&&)>
@rimunroe
rimunroe / fweep
Created December 4, 2013 20:11
Starbound commands?
/yQA
/player
/universe
/debug
/toggleperf
/togglelogmap
/boxes
/clearboxes
/togglelayer
/fullbright
@bryanmacfarlane
bryanmacfarlane / messagequeue.js
Last active July 28, 2019 23:23
node.js http long polling server. using a messaging as an example of longpoll usage.
//
// Crude node.js longpoll example via a simple message queue
//
//--------------------
// app.js
//--------------------
var queue = require('./queue/messagequeue');
app.get('/messages/:queueName/:lastMsgId', queue.getMessages);
app.post('/messages/:queueName', queue.postMessages);
@jed
jed / how-to-set-up-stress-free-ssl-on-os-x.md
Last active May 31, 2024 18:32
How to set up stress-free SSL on an OS X development machine

How to set up stress-free SSL on an OS X development machine

One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.

Most workflows make the following compromises:

  • Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.

  • Use production SSL certificates locally. This is annoying

@ericelliott
ericelliott / env-examples.md
Last active May 28, 2024 07:30
env-examples

Most configuration really isn't about the app -- it's about where the app runs, what keys it needs to communicate with third party API's, the db password and username, etc... They're just deployment details -- and there are lots of tools to help manage environment variables -- not the least handy being a simple .env file with all your settings. Simply source the appropriate env before you launch the app in the given env (you could make it part of a launch script, for instance).

env files look like this:

SOMEVAR="somevalue"
ANOTHERVAR="anothervalue"

To source it:

$ source dev.env # or staging.env, or production.env, depending on where you're deploying to