Skip to content

Instantly share code, notes, and snippets.

@prenagha
prenagha / pdfpenocr.scpt
Created November 10, 2011 14:57
applescript folder action to have docs ocr'd by pdfpen
--
-- OCR all documents added to a folder
--
on adding folder items to this_folder after receiving added_items
try
repeat with i from 1 to number of items in added_items
set this_item to item i of added_items
set appName to my getAppName()
tell application appName
activate
@sevastos
sevastos / aws-multipartUpload.js
Last active October 8, 2023 10:43
Example AWS S3 Multipart Upload with aws-sdk for Node.js - Retries to upload failing parts
// Based on Glacier's example: http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/examples.html#Amazon_Glacier__Multi-part_Upload
var fs = require('fs');
var AWS = require('aws-sdk');
AWS.config.loadFromPath('./aws-config.json');
var s3 = new AWS.S3();
// File
var fileName = '5.pdf';
var filePath = './' + fileName;
var fileKey = fileName;

Modifying an Existing Docker Image

To install a custom package or modify an existing docker image we need to

  1. run a docker a container from the image we wish to modify
  2. modify the docker container
  3. commit the changes to the container as a docker image
  4. test changes made to image

1.) Running a docker container from an image

@joshbedo
joshbedo / s3multipart.js
Created August 13, 2015 11:57
S3 multipart upload with NodeJS
var express = require('express')
var app = express()
var AWS = require('aws-sdk');
var bodyParser = require('body-parser');
var fs = require('fs');
var zlib = require('zlib'); // gzip compression
var multiparty = require('connect-multiparty'),
multipartyMiddleware = multiparty();
module.exports.requestUploadURL = (event, context, callback) => {
var s3 = new AWS.S3();
var params = JSON.parse(event.body);
var s3Params = {
Bucket: 'slsupload',
Key: params.name,
ContentType: params.type,
ACL: 'public-read',
};
@lordneon
lordneon / steps.md
Last active April 26, 2024 09:58
UK Light Wiring with Shelly 1

Intro

This is a simple guide on how to automate UK lights with a Shelly 1 by installing the shelly 1 relay into the ceiling pendant which has both permanent live, neutral and a switched live back from the wall switch.

These steps are from my own experience making my lighting "smart" but also user friendly (it works via a wall switch!). This simple guide will go through replacing an a normal ceiling pendant with one with room for a Shelly 1. If you have a ceiling light with a bigger base it's even easier.

Warning Electrical regulations must be followed by law. If you are not a competent person under the regulations do not attempt electrical work. https://www.diydoctor.org.uk/projects/electrical_safety.htm

Wiring Diagram

This diagram has been taken from here and modified to include the Shelly 1. Wiring Diagram

@andywer
andywer / _readme.md
Last active March 7, 2024 05:52
React - Functional error boundaries

React - Functional error boundaries

Thanks to React hooks you have now happily turned all your classes into functional components.

Wait, all your components? Not quite. There is one thing that can still only be implemented using classes: Error boundaries.

There is just no functional equivalent for componentDidCatch and deriveStateFromError yet.

Proposed solution

@chris-sev
chris-sev / setup.sh
Last active February 10, 2024 03:17
Mac Setup
# how to run this thingy
# create a file on your mac called setup.sh
# run it from terminal with: sh setup.sh
# heavily inspired by https://twitter.com/damcclean
# https://github.com/damcclean/dotfiles/blob/master/install.sh
# faster dock hiding/showing (run in terminal)
# defaults write com.apple.dock autohide-delay -float 0; defaults write com.apple.dock autohide-time-modifier -int 0;killall Dock
@clairechabas
clairechabas / index.js
Created May 9, 2020 20:17
File upload API endpoint handling uploads to Firebase Cloud Storage | #NodeJS #ExpressJS #Multer #Firebase #GCloudStorage #GCP
require('dotenv').config();
const express = require('express');
const app = express();
const cors = require('cors');
const bodyParser = require('body-parser');
const { Storage } = require('@google-cloud/storage');
const multer = require('multer');
const port = process.env.API_PORT || 8080;
app.use(bodyParser.json());
version: '2'
services:
mauticdb:
image: percona/percona-server:5.7
container_name: mauticdb
volumes:
- mysql_data:/var/lib/mysql
environment: