Skip to content

Instantly share code, notes, and snippets.

View denisdemais's full-sized avatar

Denis denisdemais

  • Accelero
  • Brazil, Brasilia, DF
View GitHub Profile
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <sys/resource.h>
double get_time()
{
struct timeval t;
struct timezone tzp;
gettimeofday(&t, &tzp);
@jrus
jrus / lua-uuid.lua
Created July 29, 2012 09:26
quick lua implementation of "random" UUID
local random = math.random
local function uuid()
local template ='xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'
return string.gsub(template, '[xy]', function (c)
local v = (c == 'x') and random(0, 0xf) or random(8, 0xb)
return string.format('%x', v)
end)
end
@balaam
balaam / reverseTable.lua
Created July 16, 2012 10:59
Reverse an ipairs table in Lua (not clever O(n) could be O(n/2) with swapping)
--
-- Reverses an ipairs table
--
--local r = ReverseTable({'a', 'b', 'c'})
--for k, v in ipairs(r) do
-- print(k, v)
--end
--
--
function ReverseTable(t)
@mtigas
mtigas / gist:952344
Last active April 3, 2024 07:57
Mini tutorial for configuring client-side SSL certificates.

Client-side SSL

For excessively paranoid client authentication.


Updated Apr 5 2019:

because this is a gist from 2011 that people stumble into and maybe you should AES instead of 3DES in the year of our lord 2019.

some other notes: