Skip to content

Instantly share code, notes, and snippets.

View dmpop's full-sized avatar
🇺🇦

Dmitri Popov dmpop

🇺🇦
View GitHub Profile
@dmpop
dmpop / weather-blinkstick
Last active January 25, 2016 10:56
BlinkStick flow for Node-RED
[{"id":"72aafd2f.608874","type":"exec","z":"c44f31ab.9139e8","command":"blinkstick","addpay":true,"append":"","useSpawn":"","name":"BlinkStick","x":831,"y":170,"wires":[[],[],[]]},{"id":"ba40088d.d286e8","type":"openweathermap","z":"c44f31ab.9139e8","name":"","lon":"","lat":"","city":"Aarhus","country":"Denmark","x":338,"y":173,"wires":[["a36fdbc6.490e48"]]},{"id":"95a6d5c0.afcbd","type":"inject","z":"c44f31ab.9139e8","name":"Weather Today","topic":"","payload":"","payloadType":"none","repeat":"600","crontab":"","once":true,"x":112,"y":81,"wires":[["ba40088d.d286e8"]]},{"id":"a36fdbc6.490e48","type":"function","z":"c44f31ab.9139e8","name":"Process Weather Data","func":"if (msg.payload.weather === \"Clear\") {\n msg.payload = \"--repeats 51 --pulse green\"\n return msg;\n}\n\nelse if (msg.payload.weather === \"Broken clouds\") {\n msg.payload = \"--repeats 51 --pulse yellow\"\n return msg;\n}\nelse if (msg.payload.weather === \"Rain\") {\n msg.payload = \"--repeats 51 --pulse red\"\n return msg;\n}\n
@dmpop
dmpop / weather_report
Created December 22, 2015 09:27
Weather Report flow for Node-RED
[{"id":"5b09f655.d78988","type":"openweathermap","z":"8312dc32.974a3","name":"","lon":"","lat":"","city":"Aarhus","country":"Denmark","x":363,"y":168,"wires":[["ffe6ef68.f37e"]]},{"id":"9f9af6b7.3f75e","type":"inject","z":"8312dc32.974a3","name":"Weather Today","topic":"","payload":"","payloadType":"none","repeat":"","crontab":"00 10 * * *","once":false,"x":147,"y":118,"wires":[["5b09f655.d78988"]]},{"id":"71938e7e.a647a","type":"e-mail","z":"8312dc32.974a3","server":"smtp.foobar.com","port":"465","name":"foo@bar.com","dname":"","x":778,"y":294,"wires":[]},{"id":"ffe6ef68.f37e","type":"function","z":"8312dc32.974a3","name":"Process Weather Data","func":"msg.payload = \"Weather: \" + msg.payload.detail + \", Temperature: \" + msg.payload.tempc + \"°C\" + \" Wind Speed: \" + msg.payload.windspeed + \"m/s\"\nreturn msg;","outputs":1,"noerr":0,"x":562,"y":226,"wires":[["71938e7e.a647a"]]}]
@dmpop
dmpop / pi_camera_bottle.py
Created September 13, 2015 16:38
Simple Python Bottle-based app to control Raspberry Pi camera module
#!/usr/bin/python
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@dmpop
dmpop / timplapse.py
Created July 31, 2015 12:12
SL4A-based Python script for timelapse photography
import android, time, os
droid = android.Android()
counter = 1
title = "Number of Photos"
droid.dialogCreateAlert(title)
photoCount = int(droid.dialogGetInput("Specify number of photos to take:").result)
title = "Time interval"
@dmpop
dmpop / raspberrypi.sh
Last active June 10, 2016 12:25
Raspberry Pi installation script
#!/bin/bash
if [ "$(whoami)" != "root" ]; then
echo "Run this script as sudo"
exit 1
fi
apt update
apt -y install apache2 php5 php5-gd php5-sqlite git-core fossil screen imagemagick python-pip rsync jq
pip install bottle
@dmpop
dmpop / define.py
Last active August 29, 2015 14:18
QPython script to get word definitions via Google
#-*-coding:utf8;-*-
#qpy:console
#qpy:2
import androidhelper
droid = androidhelper.Android()
s = droid.dialogGetInput('Define', 'Word to define:').result
droid.startActivity('android.intent.action.VIEW', 'https://www.google.com/search?q=define:' + s)
#!/usr/bin/perl
# Unofficial Shoot and View Receiver for Transcend Wi-Fi SD card
# Original version: http://sourceforge.net/projects/transsvr/
# This script was developed by Sven Angelmahr
# Contact sven@angelmahr.de for further details.
# DEPENDENCIES
@dmpop
dmpop / sony_nex_release
Created February 17, 2015 16:16
Sketch for SONY NEX series cameras release
int focus_pin = 11;
int release_pin = 13;
void setup() {
pinMode(release_pin, OUTPUT);
pinMode(focus_pin, OUTPUT);
}
void loop() {
digitalWrite(focus_pin, HIGH);
@dmpop
dmpop / rpiremote_server.py
Last active August 29, 2015 14:14
Python Bottle server for Raspberry Pi-based IR remote control
#!/usr/bin/python
from bottle import post, route, request, run
import os, time
@route('/')
@route('/', method='POST')
def release_control():
if (request.POST.get("shutter_release")):
os.system("irsend SEND_ONCE Nikon2 shutter")
if (request.POST.get("number")):
i = 1
@dmpop
dmpop / digikam_metadata.sh
Last active July 10, 2017 12:47
Bash shell script to extract camera and lense data from the digikam4.db database
#!/bin/bash
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the