Skip to content

Instantly share code, notes, and snippets.


Sylvain Mougenot smougenot

View GitHub Profile

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"}}
quallenbezwinger / motion_controlled_scenes_enhanced.yaml
Last active Dec 5, 2022
Homeassistant blueprint for motion-activated light scene with surrounding light level check
View motion_controlled_scenes_enhanced.yaml
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
name: Motion Sensor
dglaude / 1st_readme.txt
Last active Nov 22, 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:
geerlingguy /
Last active Oct 20, 2022
Ansible Role Test Shim Script
# Ansible role test shim.
# Usage: [OPTIONS] ./tests/
# - 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 / requirements.txt
Last active Jun 30, 2022
Serverless Elasticsearch Curator for AWS Lambda
View requirements.txt
rdammkoehler /
Created Apr 21, 2016
Copy an ISO to a USB stick with a progress bar (linux/mac)
# with a progress bar
dd if=/Users/rich/Downloads/kali-linux-2016.1-amd64.iso | pv | dd of=/dev/disk2 bs=1m
xelwarto / jenkins_haproxy_config.cfg
Created May 25, 2015
Jenkins CI haproxy configuration example
View jenkins_haproxy_config.cfg
chroot /var/lib/haproxy
crt-base /etc/pki/tls/certs
group haproxy
log local0
maxconn 2000
pidfile /var/run/
stats socket /var/lib/haproxy/stats
tune.ssl.default-dh-param 2048
hrwgc /
Created Nov 13, 2013
bash wget - check if file exists at url before downloading
# 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 /
Last active Nov 16, 2021
Script to toggle my Philips Hue lights on and off using a Raspberry Pi and a button
#!/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/ &
from time import sleep
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"