Skip to content

Instantly share code, notes, and snippets.

View smougenot's full-sized avatar

Sylvain Mougenot smougenot

  • Lyon France
  • 16:10 (UTC -12:00)
View GitHub Profile
@smougenot
smougenot / play.spec
Created March 9, 2012 10:41 — forked from dcarley/play.spec
RPM SPEC for Play Framework
Name: play
Version: 1.2.4
Release: 1%{?dist}
Summary: Play Framework
Group: System Environment/Daemons
License: Apache License, Version 2
URL: http://www.playframework.org/
Source0: http://download.playframework.org/releases/%{name}-%{version}.zip
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@rdammkoehler
rdammkoehler / copy_iso_to_usb.sh
Created April 21, 2016 20:25
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
@smougenot
smougenot / A_Logstash.conf
Created July 26, 2012 13:59
Logstash Multiline Filter for Java Stacktrace (tested on field)
# 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"
}
@natcl
natcl / light_button_control.py
Last active November 16, 2021 14:59
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/light_button_control.py &
'''
from time import sleep
@xelwarto
xelwarto / jenkins_haproxy_config.cfg
Created May 25, 2015 11:49
Jenkins CI haproxy configuration example
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
@jarpy
jarpy / requirements.txt
Last active June 30, 2022 06:28
Serverless Elasticsearch Curator for AWS Lambda
certifi==2016.8.8
elasticsearch-curator==4.0.6
PyYAML==3.11
@quallenbezwinger
quallenbezwinger / motion_controlled_scenes_enhanced.yaml
Last active October 3, 2023 13:57
Homeassistant blueprint for motion-activated light scene with surrounding light level check
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:
@hrwgc
hrwgc / validate.sh
Created November 13, 2013 19:57
bash wget - check if file exists at url before downloading
#!/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
}
@dglaude
dglaude / 1st_readme.txt
Last active January 6, 2024 14:14
Home Assistant Rainbow Loop with Ikea Tradfri RGB light
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 January 18, 2024 17:37
Ansible Role Test Shim Script
#!/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)