Skip to content

Instantly share code, notes, and snippets.

View marc-gist's full-sized avatar

Marc marc-gist

  • Toronto, Canada
View GitHub Profile
@marc-gist
marc-gist / bedside_button.yaml
Created November 25, 2023 17:30 — forked from albertnis/bedside_button.yaml
Making a custom multi-click push button using ESPHome
esphome:
name: bedside_button
platform: ESP8266
board: esp12e
wifi:
ssid: "ssid"
password: "example"
logger:
- platform: rest
name: voron24_sensor
resource: "http://192.168.8.25:7125/printer/objects/query?heater_bed&extruder&print_stats&toolhead&display_status&virtual_sdcard&temperature_sensor%20raspberry_pi&temperature_sensor%20MCU&temperature_sensor%20chamber_temp"
json_attributes_path: "$.result.status"
json_attributes:
- heater_bed
- extruder
- print_stats
- toolhead
- display_status
@marc-gist
marc-gist / zigbee2mqtt_homeassistant_control.md
Created April 9, 2019 13:28
how to setup HomeAssistant control ui for zigbee2mqtt

Pairing

The suggested way to pair your devices is to enable zigbee2mqtt's permit_join option from within Home Assistant using MQTT rather than through the add-on's User Interface. Below is an example configuration that will allow you to enable and disable device pairing from the Home Assistant front end:

screen shot 2018-06-02 at 14 41 42

mqtt:
  broker: homeassistant # This will have to be your mqtt broker
  discovery: true
@marc-gist
marc-gist / merge.py
Created March 11, 2017 00:15 — forked from edelvalle/merge.py
Merging model instances in Django 1.9
from django.db import transaction
from django.apps import apps
from django.contrib.contenttypes.fields import GenericForeignKey
from django.db.models.fields.related import ManyToManyField
@transaction.atomic()
def merge(primary_object, *alias_objects):
"""Merge several model instances into one, the `primary_object`.
Use this function to merge model objects and migrate all of the related
@marc-gist
marc-gist / social.py
Created February 23, 2017 00:35 — forked from revolunet/social.py
Sample custom pipeline for django-social-auth and Facebook backend. Goal is to ask more info to the user before creating the account and the related Customer model.
# settings.py
FACEBOOK_EXTENDED_PERMISSIONS = ['email', 'user_birthday', 'user_location']
SOCIAL_AUTH_PIPELINE = (
'social_auth.backends.pipeline.social.social_auth_user',
'social_auth.backends.pipeline.user.get_username',
'social_auth.backends.pipeline.misc.save_status_to_session',
'web.facebook.check_registered',
'social_auth.backends.pipeline.user.create_user',
'web.facebook.check_profile',
'social_auth.backends.pipeline.social.associate_user',
@marc-gist
marc-gist / gist:83057cb686782642724e
Created February 28, 2016 23:22 — forked from evildmp/gist:3094281
Set up Django, nginx and uwsgi

This document has now been incorporated into the uWSGI documentation:

http://uwsgi-docs.readthedocs.org/en/latest/tutorials/Django_and_nginx.html

Set up Django, nginx and uwsgi

Steps with explanations to set up a server using:

@marc-gist
marc-gist / gist:c0359763706695a954af
Created January 26, 2016 12:58 — forked from ekampf/gist:7721226
Code to convert temperature from Arduino's temperature sensor into heatmap RGB
const int rLED = 11;
const int gLED = 9;
const int bLED = 10;
const int sensor = A0;
const float minTemp = 10.0;
const float maxTemp = 50.0;
int redV = 0;
int greenV = 0;
@marc-gist
marc-gist / gist:a7ce36589f502eede4d9
Created January 1, 2015 20:32
bootstrap 3 ListView Pagination
{% if is_paginated %}
<ul class="pagination pagination-centered">
{% if page_obj.has_previous %}
<li><a href="?page=1"><<</a></li>
<li><a href="?page={{ page_obj.previous_page_number }}"><</a></li>
{% endif %}
{% for i in paginator.page_range %}
<li {% if page_obj.number == i %} class="active" {% endif %}><a href="?page={{i}}">{{i}}</a></li>
{% endfor %}
@marc-gist
marc-gist / accordion-groups-bootstrap.html
Created May 5, 2013 12:00
Accordion Groups (Bootstrap)
<div class="accordion" id="accordion2">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapseOne">
Collapsible Group Item #1
</a>
</div>
<div id="collapseOne" class="accordion-body collapse in">
<div class="accordion-inner">
Group 1 Body
@marc-gist
marc-gist / modal-jq-bootstrap
Last active September 26, 2019 20:35
bootstrap modal with jquery show button
<script>
/* to show modal via jquery clock event bound to id="modal_button_id" a/button/etc */
$(document).ready(function() {
$('#modal_button_id').click(function (event) {
$('#myModal').modal('show')
});
</script>
<div class="modal hide fade" id="modalID">
<div class="modal-header">