Skip to content

Instantly share code, notes, and snippets.

@lalyos
lalyos / appify.sh
Created March 24, 2022 05:48 — forked from oubiwann/appify.sh
appify — create the simplest possible Mac app from a shell script (adds an application icon)
#!/usr/bin/env bash
VERSION=4.0.1
SCRIPT=`basename "$0"`
APPNAME="My App"
APPICONS="/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/GenericApplicationIcon.icns"
OSX_VERSION=`sw_vers -productVersion`
PWD=`pwd`
function usage {
@lalyos
lalyos / debounce.lua
Created March 20, 2017 17:44 — forked from marcelstoer/debounce.lua
Debounce with NodeMCU with two separate functions for down/up trigger
-- inspired by: http://www.esp8266-projects.com/2015/03/buttons-pushbuttons-and-debouncing-story.html
local GPIO14 = 5
local debounceDelay = <however-many-ms-your-sensor-requires>
local debounceAlarmId = <0-6>
gpio.mode(GPIO14, gpio.INT, gpio.PULLUP)
gpio.trig(GPIO14, "down", doorLocked)
function doorLocked()
-- don't react to any interupts from now on and wait 50ms until the interrupt for the up event is enabled
-- within that 50ms the switch may bounce to its heart's content
@lalyos
lalyos / debounce-with-tmr.lua
Created March 20, 2017 17:44 — forked from marcelstoer/debounce-with-tmr.lua
NodeMCU debounce based on timer with GPIO pullup
-- inspired by https://github.com/hackhitchin/esp8266-co-uk/blob/master/tutorials/introduction-to-gpio-api.md
-- and http://www.esp8266.com/viewtopic.php?f=24&t=4833&start=5#p29127
local pin = 4 --> GPIO2
function debounce (func)
local last = 0
local delay = 50000 -- 50ms * 1000 as tmr.now() has μs resolution
return function (...)
local now = tmr.now()
@lalyos
lalyos / echoHttpRequest.js
Created October 27, 2016 20:25 — forked from Marak/echoHttpRequest.js
Echo HTTP requests
module['exports'] = function echoHttp (hook) {
console.log("Console messages are sent to /logs");
console.log(hook.params);
console.log(hook.req.path);
console.log(hook.req.method);
@lalyos
lalyos / main.go
Created September 22, 2016 15:59 — forked from lizrice/main.go
Container from scratch
package main
// @lizrice, mostly copied from @doctor_julz: https://gist.github.com/julz/c0017fa7a40de0543001
import (
"fmt"
"os"
"os/exec"
"syscall"
)
@lalyos
lalyos / README.md
Last active December 12, 2015 05:09 — forked from mbostock/.block

Let's see where are the G360 customers?

@lalyos
lalyos / README.md
Last active December 12, 2015 05:08 — forked from mbostock/.block

Let's see where are the buyers of g360!

@lalyos
lalyos / tool.sh
Created September 14, 2015 15:34 — forked from anonymous/tool.sh
docopts bash
#!/bin/bash
main() {
eval "$(docopts -V - -h - : "$@" <<EOF
Usage: tool [options]
--page=<page> Page numbers [default: 10]
--user=<user> Username
--password=<pwd> Password
<!DOCTYPE html>
<script src="http://mbostock.github.com/d3/d3.v2.js?2.8.1"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<style>
body {
font: 10px sans-serif;
}
rect {
@lalyos
lalyos / README.md
Last active August 29, 2015 14:05 — forked from mbostock/.block