Skip to content

Instantly share code, notes, and snippets.

Avatar

Sylvain Mougenot smougenot

View GitHub Profile
View soft_hack.md

Soft hack to open telnet

You need gateway 3(mgl03) connected to MiHome. And also ip and gateway token.

1 way (recommended)

Via XiaomiGateway3 component.

You must input in the 'Open Telnet command' field(as it is without changing anything):

{"method":"set_ip_info","params":{"ssid":"\"\"","pswd":"123123 ; passwd -d admin ; echo enable > /sys/class/tty/tty/enable; telnetd"}}
@dirkk1980
dirkk1980 / motion_controlled_scenes_enhanced.yaml
Last active Aug 8, 2022
Homeassistant blueprint for motion-activated light scene with surrounding light level check
View motion_controlled_scenes_enhanced.yaml
blueprint:
name: Motion-activated light scene with surrounding light level check and optional ambient scene
description: Turn on a light scene when motion is detected. Three different scenes can be defined depending on time of day. Furthermore a source for checking sourrounding light can be defined to enable light only if it is dark enough.
domain: automation
source_url: https://gist.github.com/dirkk1980/3e5c23acb05fb639bafdc5036b91aae6
input:
motion_entity:
name: Motion Sensor
selector:
entity:
@dglaude
dglaude / 1st_readme.txt
Last active Feb 7, 2022
Home Assistant Rainbow Loop with Ikea Tradfri RGB light
View 1st_readme.txt
Please find below the various piece of code that together control my RGB light to loop in Rainbow.
Every two seconds, it change from one colour to another based on the value of the second.
So it compute 30 differents RGB value in a "circle", all with the same Saturation and Brightness both forced to 1.0
The transition from one colour to another is done in one seconds.
The name of my Tradfri RGB light bulb is "light.couleur"
A link to my video on Twitter:
https://twitter.com/DavidGlaude/status/1059596285991366657
@geerlingguy
geerlingguy / ansible-role-test.sh
Last active Aug 7, 2022
Ansible Role Test Shim Script
View ansible-role-test.sh
#!/bin/bash
#
# Ansible role test shim.
#
# Usage: [OPTIONS] ./tests/test.sh
# - distro: a supported Docker distro version (default = "centos7")
# - playbook: a playbook in the tests directory (default = "test.yml")
# - role_dir: the directory where the role exists (default = $PWD)
# - cleanup: whether to remove the Docker container (default = true)
# - container_id: the --name to set for the container (default = timestamp)
@jarpy
jarpy / requirements.txt
Last active Jun 30, 2022
Serverless Elasticsearch Curator for AWS Lambda
View requirements.txt
certifi==2016.8.8
elasticsearch-curator==4.0.6
PyYAML==3.11
@rdammkoehler
rdammkoehler / copy_iso_to_usb.sh
Created Apr 21, 2016
Copy an ISO to a USB stick with a progress bar (linux/mac)
View copy_iso_to_usb.sh
# with a progress bar
dd if=/Users/rich/Downloads/kali-linux-2016.1-amd64.iso | pv | dd of=/dev/disk2 bs=1m
@xelwarto
xelwarto / jenkins_haproxy_config.cfg
Created May 25, 2015
Jenkins CI haproxy configuration example
View jenkins_haproxy_config.cfg
global
chroot /var/lib/haproxy
crt-base /etc/pki/tls/certs
daemon
group haproxy
log 127.0.0.1 local0
maxconn 2000
pidfile /var/run/haproxy.pid
stats socket /var/lib/haproxy/stats
tune.ssl.default-dh-param 2048
@hrwgc
hrwgc / validate.sh
Created Nov 13, 2013
bash wget - check if file exists at url before downloading
View validate.sh
#!/bin/bash
# simple function to check http response code before downloading a remote file
# example usage:
# if `validate_url $url >/dev/null`; then dosomething; else echo "does not exist"; fi
function validate_url(){
if [[ `wget -S --spider $1 2>&1 | grep 'HTTP/1.1 200 OK'` ]]; then echo "true"; fi
}
@natcl
natcl / light_button_control.py
Last active Nov 16, 2021
Script to toggle my Philips Hue lights on and off using a Raspberry Pi and a button
View light_button_control.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
This script toggles lights on and off using the phue library and a physical switch
It is started on boot in /etc/rc.local with this line:
python /home/pi/light_button_control/light_button_control.py &
'''
from time import sleep
@smougenot
smougenot / A_Logstash.conf
Created Jul 26, 2012
Logstash Multiline Filter for Java Stacktrace (tested on field)
View A_Logstash.conf
# stacktrace java as one message
multiline {
#type => "all" # no type means for all inputs
pattern => "(^.+Exception: .+)|(^\s+at .+)|(^\s+... \d+ more)|(^\s*Caused by:.+)"
what => "previous"
}