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)
View appify.sh
#!/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
View debounce.lua
-- 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
View debounce-with-tmr.lua
-- 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
View echoHttpRequest.js
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
View main.go
package main
// @lizrice, mostly copied from @doctor_julz: https://gist.github.com/julz/c0017fa7a40de0543001
import (
"fmt"
"os"
"os/exec"
"syscall"
)
@lalyos
lalyos / tool.sh
Created September 14, 2015 15:34 — forked from anonymous/tool.sh
docopts bash
View tool.sh
#!/bin/bash
main() {
eval "$(docopts -V - -h - : "$@" <<EOF
Usage: tool [options]
--page=<page> Page numbers [default: 10]
--user=<user> Username
--password=<pwd> Password
@lalyos
lalyos / README.md
Last active August 29, 2015 14:05 — forked from mbostock/.block
View README.md
View index.html
<!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 {
View gist:9df1e9be35116c147ff0
{
"configurations": [
{
"global": {
"nagios_contact": "admin@localhost"
}
},
{
"hdfs-site": {
"dfs.datanode.data.dir": "/mnt/fs1/,/mnt/fs2/"
View loadchain.go
package main
import (
"fmt"
"net/http"
"crypto/tls"
"crypto/x509"
"encoding/pem"
)
var chain=`-----BEGIN CERTIFICATE-----
MIIG5jCCBc6gAwIBAgIQAze5KDR8YKauxa2xIX84YDANBgkqhkiG9w0BAQUFADBs