Skip to content

Instantly share code, notes, and snippets.

@mcmatrix
mcmatrix / Merging PR for 2 branches
Created June 22, 2018 17:35 — forked from alopresto/Merging PR for 2 branches
Instructions to merge pull requests for multiple branches (master, support, etc.)
#Steps to merge/close pull requests with two main branches
As NiFi now has a 1.0 (master) and 0.x (support) branch, pull requests (PR) must be applied to both. Here is a step-by-step guide for committers to ensure this occurs for all PRs.
1. Check out the latest master
``` $ git checkout master
$ git pull upstream master
```
2. Check out the PR (example #327). This will be in `detached-HEAD` state. (Note: You may need to edit the `.git/config` file to add the `fetch` lines [below](#fetch))
@mcmatrix
mcmatrix / grrr.sh
Created June 22, 2018 17:36 — forked from Bertrand/grrr.sh
merge master into staging and staging into testing
#!/bin/sh
git diff --quiet --exit-code
if [ $? -ne 0 ]; then
echo "Cannot run grrr if you have uncommited changes"
exit -1;
fi
current_branch=`git rev-parse --abbrev-ref HEAD`
if [ "$current_branch" == "HEAD" ]; then
@mcmatrix
mcmatrix / 0fixup.md
Created July 27, 2018 13:38 — forked from silent1mezzo/0fixup.md
On undoing, fixing, or removing commits in git

A git choose-your-own-adventure!

This document is an attempt to be a fairly comprehensive guide to recovering from what you did not mean to do when using git. It isn't that git is so complicated that you need a large document to take care or your particular problem, it is more that the set of things that you might have done is so large that different techniques are needed depending on exactly what you have done and what you want to have happen.

@mcmatrix
mcmatrix / pr.md
Last active October 15, 2018 19:42 — forked from piscisaureus/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@mcmatrix
mcmatrix / snake.py
Created November 29, 2019 14:44 — forked from sanchitgangwar/snake.py
Snakes Game using Python
# SNAKES GAME
# Use ARROW KEYS to play, SPACE BAR for pausing/resuming and Esc Key for exiting
import curses
from curses import KEY_RIGHT, KEY_LEFT, KEY_UP, KEY_DOWN
from random import randint
curses.initscr()
win = curses.newwin(20, 60, 0, 0)
@mcmatrix
mcmatrix / ModelForm.js
Created January 27, 2020 15:21 — forked from esatterwhite/ModelForm.js
Class For rendering and validating forms in Sencha Touch
/**
* Module for General utility functions and classes
* @module utils
*
*/
Ext.ns('BlackjackM','BlackjackM.utils', 'BlackjackM.utils.forms');
/**
* A class which renders and validates a form based on a Ext.data.Model or Model instace

Setting up MiLight Wifi Bridge and LimitlessLED bulbs with Amazon Alexa and Home Automation Bridge

Goal of this tutorial

Be able to control MiLight bulbs with Amazon Alexa via the MiLight Wifi Bridge.

Materials

@mcmatrix
mcmatrix / light.py
Created June 25, 2020 20:26 — forked from ybarigou/light.py
Flux_led corrected bugs related to hassio and Google Home/Alexa interactions - https://www.buymeacoffee.com/ybarigou
"""Support for Flux lights."""
import logging
import random
###
# Added for MagicLight hack
import time
from flux_led import BulbScanner, WifiLedBulb
import voluptuous as vol
@mcmatrix
mcmatrix / tuyadimmer_lightoutput.h
Created July 13, 2020 12:15 — forked from placidorevilla/tuyadimmer_lightoutput.h
Prototype esphome component for Tuya Dimmer
#pragma once
#include "esphome.h"
using namespace esphome;
enum TuyaCmd : uint8_t {
HEARTBEAT = 0x00,
QUERY_PRODUCT = 0x01,
MCU_CONF = 0x02,
WIFI_STATE = 0x03,
#GPIO0 Long Press MCU
#GPIO14 Green LED
#GPIO1 UART TX
#GPIO3 UART RX
esphome:
board_flash_mode: dout
includes:
- custom/tuyadimmer_lightoutput.h