Skip to content

Instantly share code, notes, and snippets.

View corford's full-sized avatar
👋

Charlie Orford corford

👋
View GitHub Profile
int mingw_lstat(const char *file_name, struct stat *buf)
{
WIN32_FILE_ATTRIBUTE_DATA fdata;
WIN32_FIND_DATAW findbuf;
wchar_t wfilename[MAX_LONG_PATH];
int wlen = xutftowcs_long_path(wfilename, file_name);
if (wlen < 0)
return -1;
/* strip trailing '/', or GetFileAttributes will fail */
@corford
corford / gist:9a206664bb8278c8243821d236665d94
Created September 17, 2017 17:45
Creating a Root CA, intermediate Sub-CA and end entity cert
This gist gives you the commands and config necessary to quickly and safely:
- Create a Root Certififacte Authority (valid until the year ~2045 and whose key is meant to be stored somewhere secure and hard to get at e.g. on USB key in an off-prem vault)
- Create an intermediate sub-root certificate authority (which is used for day to day signing of end-entity certs)
- Create an end-entity cert (e.g. for securing nginx/apache)
For more background, see: https://developers.yubico.com/PIV/Guides/Certificate_authority.html
int mingw_lstat(const char *file_name, struct stat *buf)
{
WIN32_FILE_ATTRIBUTE_DATA fdata;
WIN32_FIND_DATAW findbuf;
wchar_t wfilename[MAX_LONG_PATH];
int wlen = xutftowcs_long_path(wfilename, file_name);
if (wlen < 0)
return -1;
/* strip trailing '/', or GetFileAttributes will fail */
@corford
corford / gist:9136735
Created February 21, 2014 15:51
Keybase proof
### Keybase proof
I hereby claim:
* I am corford on github.
* I am charlie (https://keybase.io/charlie) on keybase.
* I have the public key with fingerprint 91E0&nbsp;61BF&nbsp;B958&nbsp;5886&nbsp;DB38&nbsp;&nbsp;59B7&nbsp;227B&nbsp;18FB&nbsp;AC14&nbsp;3C82
To claim this, I am signing this object:
@corford
corford / gist:6697919
Last active December 23, 2015 21:39
Jquery plugin to fake 'position: sticky'
// Jquery plugin to fake 'position: sticky' (note: relies on underscore.js for throttling, debouncing and passing in options)
(function ($, _) {
$.fn.fakeSticky = function (options) {
var opts = _.extend({
width_guide_id: 'fake-sticky-width-guide', // This allows the sticky element to support having a % based width value (useful for responsive designs)
pin_boundary_offset: 0, // Increase this if you want to prevent the bottom edge of the sticky element getting too close to the bottom edge of its container
scroll_throttle_ms: 15,
debounce_timer_ms: 25
}, options);