Skip to content

Instantly share code, notes, and snippets.

View szensk's full-sized avatar
🔷

Jon Havron szensk

🔷
View GitHub Profile
@lauris
lauris / markov.py
Last active February 6, 2018 15:21
Markov Chains
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import random
import string
import re
from collections import Counter
package main
import (
"net/http"
"database/sql"
"fmt"
"log"
"os"
)
@leafo
leafo / gist:6788652
Last active May 1, 2019 13:28
Making nonblocking http requests with lua-ev and LuaSocket
bit = require "bit"
ev = require "ev"
ltn12 = require "ltn12"
socket = require "socket"
-- make protect and newtry coroutine friendly
socket.protect = (fn) -> fn
socket.newtry = (finalizer) ->
(...) ->
@markandgo
markandgo / utf8.lua
Last active March 30, 2025 08:44
Kyle Smith's utf8.lua with some extra functions
-- $Id: utf8.lua 179 2009-04-03 18:10:03Z pasta $
--
-- Provides UTF-8 aware string functions implemented in pure lua:
-- * string.utf8len(s)
-- * string.utf8sub(s, i, j)
-- * string.utf8reverse(s)
-- * string.utf8char(unicode)
-- * string.utf8unicode(s, i, j)
-- * string.utf8gensub(s, sub_len)
--
-- Project: Dropbox Module
-- Description: A module for accessing Dropbox from Lua/CoronaSDK using the Dropbox REST API. Module written
-- by F. E. Torkel, based off code by Michael Weingarden.
local lfs = require( "lfs" )
local json = require( "json" )
local M = {}
@AlliedEnvy
AlliedEnvy / delaunay.lua
Created June 5, 2011 23:04
Delaunay Triangulation and Relative Network Graph
--[[
Delaunay Triangulation Code, by Joshua Bell
http://www.travellermap.com/tmp/delaunay.js
Ported to Lua by Daniel Levy
Inspired by: http:www.codeguru.com/cpp/data/mfc_database/misc/article.php/c8901/
This work is hereby released into the Public Domain. To view a copy of the public
domain dedication, visit http:creativecommons.org/licenses/publicdomain/ or send
a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco,