Skip to content

Instantly share code, notes, and snippets.

Prerequisites

Root access to an Ubuntu 16.04 installation via SSH, first run these commands before anything else.

sudo apt-get update 
sudo apt-get install openvpn easy-rsa 

1. Install OpenVPN Server

@catwell
catwell / local-by-default.md
Last active December 16, 2015 14:49
Why not "local by default".

Why "local by default" is wrong?

One of the main criticisms of Lua is that the scope of a variable is global by default. This is not perfect, and people who have worked with me know I don't like useless globals.

That being said, I think the solution some people advocate ("Do like Python!!1") is "wrong". Global by default is clumsy but it makes sense because there is only one global scope. Local by default and a "global" keyword causes aliasing issues because there are other levels of scope besides "local" and "global".

Instead of a long explanation, let's take an example: you cannot do this in Python.

a = 1
@stevedonovan
stevedonovan / globalsplus.lua
Last active December 11, 2015 12:48
An extended undefined variable checker for Lua 5.1 using bytecode analysis based on David Manura's globalplus.lua http://lua-users.org/wiki/DetectingUndefinedVariables
-- globalsplus.lua
-- Like globals.lua in Lua 5.1.4 -- globalsplus.lua
-- Like globals.lua in Lua 5.1.4 but records fields in global tables too.
-- Probably works but not well tested. Could be extended even further.
--
-- usage: lua globalsplus.lua example.lua
--
-- D.Manura, 2010-07, public domain
--
-- See http://lua-users.org/wiki/DetectingUndefinedVariables
@bortels
bortels / Base64.lua
Created December 6, 2011 05:56
Base64 encode/decode for Codea (Lua)
-- Lua 5.1+ base64 v3.0 (c) 2009 by Alex Kloss <alexthkloss@web.de>
-- licensed under the terms of the LGPL2
-- character table string
local b='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
-- encoding
function enc(data)
return ((data:gsub('.', function(x)
local r,b='',x:byte()