Skip to content

Instantly share code, notes, and snippets.

@kenci
kenci / mysql_dump.sh
Last active September 4, 2016 14:07
Dump MySQL Databases
mysql -u username -h hostname.lan -p databasename < piwigo.sql
@kenci
kenci / gen_host.sh
Created June 21, 2016 18:15
dd-wrt adblock script
#!/bin/sh
##################################################################################
##
## gen_hosts by IronManLok
##
## Downloads domain entries of known ad abusers from multiple sources,
## cleans up, merges and removes duplicates. Includes white-listing and
## custom host entries.
##
@kenci
kenci / additional config
Last active June 17, 2016 08:46
DD-WRT OPENVPN
push "route 192.168.1.0 255.255.255.0"
server 192.168.66.0 255.255.255.0
dev tun0
proto udp
port 1194
keepalive 15 60
daemon
verb 3
@kenci
kenci / update-redis.txt
Created March 21, 2016 10:00
Update redis
git clone --branch 2.2.7 https://github.com/phpredis/phpredis​
cd phpredis
​cat php_redis.h | grep VERSION
phpize
./configure
sudo make
sudo make install
/*
PROJECT: MySensors / LiON charger board
PROGRAMMER: AWI
DATE: 28 april 2015/ last update: 11 may 2015 / BH1750 added: 5 September 2015
FILE: MS_Solar_2.ino
LICENSE: Public domain
Hardware: Ceech - ATmega328p board w/ ESP8266 and NRF24l01+ socket LTC4067 lithium battery charger
and MySensors 1.4
@kenci
kenci / nodered
Created February 19, 2016 22:27
Nodered init.d
#! /bin/sh
# Starts and stops Node-RED
# /etc/init.d/nodered
### BEGIN INIT INFO
# Provides: node-red
# Required-Start: $syslog
# Required-Stop: $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Node-RED initialisation
@kenci
kenci / mosquitto
Created February 19, 2016 21:48
Mosquitto Init.d
#! /bin/sh
### BEGIN INIT INFO
# Provides: mosquitto
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: mosquitto MQTT v3.1 message broker
# Description:
@kenci
kenci / socket-pimatic.js
Created February 1, 2016 12:35
Pimatic socket
var io = require('/usr/local/lib/node_modules/socket.io/node_modules/socket.io-client');
var mqtt = require('/usr/local/lib/node_modules/mqtt');
var mqttClient = mqtt.connect('mqtt://mqtt.server.ip', {
username: 'user',
password: 'password',
rejectUnauthorized: false
});
var host = 'pimatichost';
var port = 1607; //pimatic port
var u = encodeURIComponent('user'); //pimatic username
@kenci
kenci / alarmsystem.ino
Last active January 23, 2023 13:38
ESP8266 NTP Timeserver with Alarms
/*
* alarmsystem.ino
*
* This sketch uses the ESP8266WiFi library
*/
#include <TimeLib.h>
#include <Time.h>
#include <TimeAlarms.h>
#include <ESP8266WiFi.h>
@kenci
kenci / ftoa.ino
Last active November 22, 2015 19:03
Pulse decoder for S0 Interface
//
// Produce a formatted string in a buffer corresponding to the value provided.
// If the 'width' parameter is non-zero, the value will be padded with leading
// zeroes to achieve the specified width. The number of characters added to
// the buffer (not including the null termination) is returned.
//
unsigned
fmtUnsigned(unsigned long val, char *buf, unsigned bufLen, byte width)
{