Skip to content

Instantly share code, notes, and snippets.

View kirubz's full-sized avatar
🎯
Focusing

Kirubaharan Palani kirubz

🎯
Focusing
View GitHub Profile
@kirubz
kirubz / openresty
Last active September 20, 2015 09:28 — forked from pwm/openresty
openresty init script
#!/bin/bash
#
# chkconfig: 2345 55 25
# description: Openresty
# processname: nginx
# config: /usr/local/openresty/nginx/conf/nginx.conf
# pidfile: /usr/local/openresty/nginx/logs/nginx.pid
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $local_fs $remote_fs $network $named $syslog $time
@kirubz
kirubz / openresty-luarocks.sh
Created September 25, 2015 06:18 — forked from yagop/openresty-luarocks.sh
OpenResty + LuaRocks
wget http://openresty.org/download/ngx_openresty-1.7.10.1.tar.gz \
-O ngx_openresty-1.7.10.1.tar.gz
tar xzvf ngx_openresty-1.7.10.1.tar.gz
cd ngx_openresty-1.7.10.1
./configure
make
sudo make install
wget https://codeload.github.com/keplerproject/luarocks/tar.gz/v2.0.13 \
-- returns the degrees between (0,0) and pt (note: 0 degrees is 'east')
function angleOfPoint( pt )
local x, y = pt.x, pt.y
local radian = math.atan2(y,x)
local angle = radian*180/math.pi
if angle < 0 then angle = 360 + angle end
return angle
end
-- returns the degrees between two points (note: 0 degrees is 'east')
@kirubz
kirubz / angle-between-points.js
Created August 10, 2016 05:07 — forked from conorbuck/angle-between-points.js
JavaScript: Find the angle between two points
var p1 = {
x: 20,
y: 20
};
var p2 = {
x: 40,
y: 40
};
-- rotates a point around the (0,0) point by degrees
-- returns new point object
function rotatePoint( point, degrees )
local x, y = point.x, point.y
local theta = math.rad( degrees )
local pt = {
x = x * math.cos(theta) - y * math.sin(theta),
y = x * math.sin(theta) + y * math.cos(theta)
@kirubz
kirubz / xhr.js
Created January 30, 2017 12:55 — forked from jkk/xhr.js
function postJson(method, url, params) {
let xhr = new XMLHttpRequest();
xhr.open(method, url, true);
xhr.setRequestHeader('Content-Type', 'application/json; charset=UTF-8');
xhr.send(JSON.stringify(params));
xhr.onreadystatechange = function() {
let status;
let data;
if (xhr.readyState === 4) {
status = xhr.status;
@kirubz
kirubz / lua-uuid.lua
Created March 23, 2017 06:22 — forked from jrus/lua-uuid.lua
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
@kirubz
kirubz / example.lua
Created November 20, 2017 21:34 — forked from mebens/example.lua
Doubly linked list in Lua
require("list")
local a = { 3 }
local b = { 4 }
local l = list({ 2 }, a, b, { 5 })
l:pop()
l:shift()
l:push({ 6 })
l:unshift({ 7 })

HP ZBook 15 G3 - Ubuntu GNOME - 16.04 LTS

*: Included in the image

Disk /dev/nvme0n1: 477 GiB, 512110190592 bytes, 1000215216 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
-- mathlib.lua
--[[
Maths extension library for use in Corona SDK by Matthew Webster.
All work derived from referenced sources.
twitter: @horacebury
blog: http://springboardpillow.blogspot.co.uk/2012/04/sample-code.html
code exchange: http://code.coronalabs.com/search/node/HoraceBury
github: https://gist.github.com/HoraceBury