Skip to content

Instantly share code, notes, and snippets.

View artoliukkonen's full-sized avatar

Arto Liukkonen artoliukkonen

View GitHub Profile
var cors = require('cors')
var fs = require('fs')
var bodyParser = require('body-parser')
var express = require('express'),
app = express(),
port = process.env.PORT || 8080;
app.use(cors())
app.use(bodyParser.json());
const tradfriLib = require("node-tradfri-client");
const TradfriClient = tradfriLib.TradfriClient;
const AccessoryTypes = tradfriLib.AccessoryTypes;
const tradfri = new TradfriClient("192.168.100.101");
const lightbulbs = {};
const plugs = {};
const devices = {};
const connect = async () => {
@artoliukkonen
artoliukkonen / generate-thumbs.sh
Created September 18, 2019 12:21
Script to create 2000x thumbnails from Canon RAW images, and store those in same hierarchy under "thumbs" folder. Also preserves metadata info from original RAW.
#!/bin/sh
set -e
cd /mnt/usb/
for d in */; do
echo $d
if [ ! -d "$d/thumbs" ]; then
echo "generating thumbs"
exiftool -b -PreviewImage -w "$d/thumbs/%f.jpg" -ext CR2 -r "$d"
exiftool -tagsfromfile "$d/%f.CR2" -all:all -r -overwrite_original -ext jpg "$d/thumbs"
mogrify "$d/thumbs/*.jpg" -resize 2000x "$d/thumbs/*"
@artoliukkonen
artoliukkonen / BlogStorage.js
Last active December 2, 2018 21:55
Serverless blog workshop snippets
const AWS = require('aws-sdk');
const config = {
region: AWS.config.region || process.env.SERVERLESS_REGION || 'eu-west-1',
};
const dynamodb = new AWS.DynamoDB.DocumentClient(config);
class BlogStorage {
constructor() {