Skip to content

Instantly share code, notes, and snippets.

António P. P. Almeida perusio

  • Perusio LLC & UP42
  • Berlin, Germany
Block or report user

Report or block perusio

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View dockerCheatSheet.md
@thomasnorris
thomasnorris / Raspberry Pi Kiosk Setup.md
Last active Oct 15, 2019
Instructions for installing a fresh image of Raspbian and turning the Pi into a kiosk (for google slides, google photos, etc)
View Raspberry Pi Kiosk Setup.md

Raspberry Pi Kiosk Setup

  • Install a fresh image of Raspbian and boot the Pi
  • Go through the prompts to finish initial setup
  • Open a Termial window
    • Type sudo apt-get install unclutter
    • Type sudo raspi-config
      • Select Boot Options with Enter
        • Select Wait for Network at Boot with Enter
        • Select Yes with Enter
@bitingsock
bitingsock / cycle-adevice.lua
Last active Sep 10, 2019
Cycle through available audio devices with key binds(shift+a,ctrl+a). Change "wasapi" on line 13 to your relevant audio api.
View cycle-adevice.lua
local deviceList = {}
local function cycle_adevice(s, e, d)
while s ~= e + d do -- until the loop would cycle back to the number we started on
if string.find(mp.get_property("audio-device"), deviceList[s].name, 1, true) then
while true do
if s + d == 0 then --the device list starts at 1; 0 means we iterated to far
s = #deviceList + 1 --so lets restart at the last device
elseif s + d == #deviceList + 1 then --we iterated past the last device
s = 0 --then start from the beginning
@marklkelly
marklkelly / nginx.conf
Last active Jan 12, 2017
OpenResty & ssl_certificate_by_lua_file example
View nginx.conf
#Simplified for illustrative purposes.
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
View tls-redis-cached.lua
local log = ngx.log
local exit = ngx.exit
local null = ngx.null
local ERR = ngx.ERR
local INFO = ngx.INFO
local DEBUG = ngx.DEBUG
local HTTP_INTERNAL_SERVER_ERROR = ngx.HTTP_INTERNAL_SERVER_ERROR
-- Setup Redis connection
local redis = require "resty.redis"
@haggen
haggen / string.random.lua
Last active Dec 21, 2018
Random strings in Lua
View string.random.lua
local charset = {}
-- qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890
for i = 48, 57 do table.insert(charset, string.char(i)) end
for i = 65, 90 do table.insert(charset, string.char(i)) end
for i = 97, 122 do table.insert(charset, string.char(i)) end
function string.random(length)
math.randomseed(os.time())
@LinuxJedi
LinuxJedi / nginx.gdb
Created Jul 15, 2015
GDB functions for NGINX
View nginx.gdb
define ddl
set $log = ngx_cycle->log
while ($log != 0) && ($log->writer != ngx_log_memory_writer)
set $log = $log->next
end
if ($log->wdata != 0)
set $buf = (ngx_log_memory_buf_t *) $log->wdata
dump memory debug_log.txt $buf->start $buf->end
@calio
calio / clock_gettime
Last active Jan 11, 2018
clock_gettime() via LuaJIT + FFI
View clock_gettime
local ffi = require("ffi")
ffi.cdef[[
typedef long time_t;
typedef int clockid_t;
typedef struct timespec {
time_t tv_sec; /* seconds */
long tv_nsec; /* nanoseconds */
} nanotime;
@stephan-nordnes-eriksen
stephan-nordnes-eriksen / key-value-performance-test.md
Last active Aug 19, 2019
Performance testing different Key-Value stores in Ruby
View key-value-performance-test.md

For a project I am on I need to use a key-value store to converts file-paths to fixnum IDs. The dataset will typically be in the range of 100 000 to 1 000 000. These tests use 305 000 file paths to fixnum IDs.

The Different Key-Value stores tested are:

Daybreak: "Daybreak is a simple and very fast key value store for ruby" GDBM: GNU dbm. "a simple database engine for storing key-value pairs on disk." DBM: "The DBM class provides a wrapper to a Unix-style dbm or Database Manager library" PStore: "PStore implements a file based persistence mechanism based on a Hash. "

Out of these, all except Daybreak are in the Ruby standard library.

View app.js
var Crawler = require("simplecrawler");
var querystring = require('querystring');
var myCrawler = new Crawler("www.geocaching.com", "/login/");
myCrawler.initialProtocol = "https";
myCrawler.acceptCookies = true;
myCrawler.on("addcookie", function (cookie) {
console.log("Cookie");
});
You can’t perform that action at this time.