Skip to content

Instantly share code, notes, and snippets.

@tonyfg
tonyfg / docker-compose.yml
Created November 18, 2020 11:27
Docker compose file for home assistant + domoticz + mosquitto + zigbee2mqtt
version: "3"
services:
domoticz:
image: linuxserver/domoticz:latest
container_name: domoticz
environment:
- PUID=19000
- PGID=19000
- TZ=Europe/Lisbon
volumes:
@humphreyja
humphreyja / active_admin.rb
Created November 13, 2019 19:58
Include react components into active admin using React On Rails.
# config/initializers/active_admin.rb
#...
module ActiveAdmin
module Views
# Defines a `react_component` active admin component. It allows you
# to include react components into active admin using React On Rails.
# Example:
#
@DSKonstantin
DSKonstantin / Auto start puma via systemctl description
Last active November 16, 2023 16:14
Auto start puma via systemctl
Article: https://github.com/puma/puma/blob/master/docs/systemd.md
#1 nano /etc/systemd/system/puma.service
#2 paste from puma.service
Commands:
# After installing or making changes to puma.service
systemctl daemon-reload
# Enable so it starts on boot
systemctl enable puma.service
@pinge
pinge / mobile.video.encoding.md
Last active March 19, 2024 20:06
Video and audio encoding for playback in Android and iOS devices

Video and audio encoding for playback in Android and iOS devices

This document aims to provide an easy way encode video optimized for playback in mobile devices that use the Android or the iOS operating systems.

libx264 is used for (single or two-pass) video encoding and libfdk_aac for audio encoding.

ffmpeg, libx264 and libfdk_aac settings are optimized for playback quality and compatibility on Android and iOS. There is extensive documentation and references for each of the settings used and contributions are very welcome :)

@ninoseki
ninoseki / test.rb
Created December 12, 2018 02:37
Playing with wss://certstream.calidog.io in Ruby
require 'faye/websocket'
require 'eventmachine'
require "json"
EM.run {
ws = Faye::WebSocket::Client.new("wss://certstream.calidog.io")
ws.on :message do |event|
message = JSON.parse(event.data)
all_domains = message.dig("data", "leaf_cert", "all_domains")
@ispiropoulos
ispiropoulos / shelly.py
Created August 28, 2018 09:16
Shelly Switch Home Assistant Component
"""
Support for The Shelly Wifi switch.
Save this file inside ".homeassistant/custom_components/switch" (create the folders if not present) and restart HASS.
usage example:
switch:
- platform: shelly
switches:
@ebidel
ebidel / coverage.js
Last active April 27, 2024 04:13
CSS/JS code coverage during lifecycle of page load
Moved to https://github.com/ebidel/puppeteer-examples
@jjhiew
jjhiew / default.nginx.conf
Last active November 4, 2020 22:18
Nginx configuration to setup SSL Termination and Reverse Proxy for Sendgrid Link Tracking
# Should go into `/etc/nginx/sites-available` as file named `default`
# Redirect HTTP to HTTPS
server {
listen 80;
return 301 https://$host$request_uri;
}
server {
listen 443;
@matsukaz
matsukaz / application.rb
Last active January 8, 2024 14:30
Rails connection management to handle Amazon Aurora's failover
module xxx
class Application < Rails::Application
#(中略)
config.middleware.swap ActiveRecord::ConnectionAdapters::ConnectionManagement,
'ActiveRecord::ConnectionAdapters::ReconnectOnErrorManagement'
end
end

Install dlib and face_recognition on a Raspberry Pi

Instructions tested with a Raspberry Pi 2 with an 8GB memory card. Probably also works fine on a Raspberry Pi 3.

Steps

Download the latest Raspbian Jessie Light image. Earlier versions of Raspbian won't work.

Write it to a memory card using Etcher, put the memory card in the RPi and boot it up.