Skip to content

Instantly share code, notes, and snippets.

View alexgorbatchev's full-sized avatar
👋

Alex Gorbatchev alexgorbatchev

👋
View GitHub Profile
blueprint:
name: Send Camera snapshot when if a binary sensor's state turns 'off' to 'on', with Conditions
description: This automation blueprint creates a camera snapshot if motion is detected, or if a binary sensor's state turns 'off' to 'on', and sends a notification to your phone with the picture. (v1.01)
domain: automation
input:
condition:
name: Add Condition(s)
description: Add conditions if needed
default: []
selector:
@alexgorbatchev
alexgorbatchev / generate_cert.sh
Created September 9, 2014 13:26
Generate self signed https certificates for node.js express/hapi/etc
#!/bin/bash
openssl genrsa -out key.pem
openssl req -new -key key.pem -out csr.pem
openssl x509 -req -days 9999 -in csr.pem -signkey key.pem -out cert.pem
rm csr.pem
@alexgorbatchev
alexgorbatchev / FastLEDDisk.ino
Created September 8, 2017 22:50 — forked from adammhaile/FastLEDDisk.ino
Examples of using angle and radius to select pixels on a circular pixel layout using FastLED
#include "FastLED.h"
#define NUM_LEDS 255
#define DATA_PIN SPI_DATA
#define CLOCK_PIN SPI_CLOCK
// Define the array of leds
CRGB leds[NUM_LEDS];
-----------------------------------------------------------------------------
"Efficient and Portable Combined Random Number Generators",
Pierre L'Ecuyer, Communications of the ACM, June, 1988 (v31 #6)
"Random Number Generators: Good Ones Are Hard To Find",
Park, Stephen K., and Miller, Keith W.,
Communications of the ACM, October, 1988.
(see below)
Conclusions :- horrible random (sic) number generators are used by people
@alexgorbatchev
alexgorbatchev / gist:8428232
Created January 14, 2014 23:48
MEAN folder structure
/node_modules
/package.json
/src
/node_modules
/client -> ../client
/server -> ../server
/shared -> ../shared
/client
/apps
/main
####################################
# BASIC REQUIREMENTS
# http://graphite.wikidot.com/installation
# http://geek.michaelgrace.org/2011/09/how-to-install-graphite-on-ubuntu/
# Last tested & updated 10/13/2011
####################################
sudo apt-get update
sudo apt-get upgrade
var sys = require("sys");
var http = require("http");
var connections=[];
function update() {
if (connections.length) {
connections.forEach(function(c) {
sys.puts(c);
c.write('oi\n');
@alexgorbatchev
alexgorbatchev / merge.sh
Created September 7, 2014 16:22
Merge one git repo into another preserving history
#!/bin/bash
other_project=$1
git remote add -f $other_project ../$other_project
git merge -s ours --no-commit $other_project/master
git read-tree --prefix=$other_project -u $other_project/master
git commit -m "Merged $other_project"

Hey. Crazy kids. This probably needs to be that one event where you sort of realize: "Oh. Shit. Other people...like...use this & stuff. We need a damn road map and a release schedule. Stop smoking dabs all day, breh."

Now is also a great time to learn how to think about the potential ramifications a production push will have prior to making said production push. And, if your change might impact some or perhaps even all of the other people who use your technology, then some degree of coordination - perhaps an email? - would be nice. It's one of those things that will help make you look professional. I suck at professionalism. You have no idea. But, even I know this much.

Because, right now, I sort of feel like I'm asking some very rightfully fearful people to consider entrusting perhaps their actual career into the development of technology they need to succeed and thrive. And, I just started recommending Node.js - with a caveat - that npm basically sucks. I hate having to do that and it needs to stop.

So,