Skip to content

Instantly share code, notes, and snippets.

@mbarcia
mbarcia / motion_controlled_scenes_enhanced.yaml
Last active August 10, 2022 01:48 — forked from quallenbezwinger/motion_controlled_scenes_enhanced.yaml
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:
@mbarcia
mbarcia / motion_switch.yaml
Last active June 23, 2022 16:01
HA Blueprint
blueprint:
name: Motion-activated Switch
description: Turn on a switch when motion is detected.
domain: automation
input:
motion_entity:
name: Motion Sensor
selector:
entity:
domain: binary_sensor
@mbarcia
mbarcia / branches-cleanup.sh
Last active August 13, 2018 14:50
Cleanup of branches already merged
# Git clone the repository
git clone git@github.com:mbarcia/drupsible-project.git
cd drupsible-project/
# Track all remote branches in the local repository
git branch -a | grep -v HEAD | perl -ne 'chomp($_); s|^\*?\s*||; if (m|(.+)/(.+)| && not $d{$2}) {print qq(git branch --track $2 $1/$2\n)} else {$d{$_}=1}' | csh -xfs
# Delete those branches already merged into master (in the remote repository)
git branch --merged | grep -v "master" | grep -v "*" | grep -v "\." | xargs -I % git push --delete origin %
#!/bin/sh
PROJECTS=(drupsible-apache \
drupsible-composer \
drupsible-deploy \
drupsible-drush \
drupsible-memcached \
drupsible-mysql \
ansible-newrelic \
drupsible-varnish \
#!/bin/sh
# Note: ~/.ssh/environment should not be used, as it
# already has a different purpose in SSH.
env="$HOME/.ssh-agent"
# Note: Don't bother checking SSH_AGENT_PID. It's not used
# by SSH itself, and it might even be incorrect
# (for example, when using agent-forwarding over SSH).
@mbarcia
mbarcia / local.lavanguardia.com
Last active January 17, 2016 20:11
host_vars config file
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
@mbarcia
mbarcia / gist:38b2a1488ba23981a918
Last active December 14, 2015 16:27
ip_address()
/**
* Returns the IP address of the client machine.
*
* If Drupal is behind a reverse proxy, we use the X-Forwarded-For header
* instead of $_SERVER['REMOTE_ADDR'], which would be the IP address of
* the proxy server, and not the client's. The actual header name can be
* configured by the reverse_proxy_header variable.
*
* @return
* IP address of client machine, adjusted for reverse proxy and/or cluster
@mbarcia
mbarcia / memcached
Created November 4, 2015 09:25
/etc/init.d/memcached for CentOS 5
#!/bin/sh
#
# memcached Startup script for memcached processes
#
# chkconfig: - 90 10
# description: Memcache provides fast memory based storage.
# processname: memcached
# These mappings correspond one-to-one with Drupal's settings.php file.
@mbarcia
mbarcia / gist:1f0158dff2b366a4133f
Created September 23, 2015 06:06
Drupsible 0.9.2 D7 commerce_profile setup
Mariano@avedeplata MINGW64 ~/drupsible
$ git clone https://github.com/mbarcia/drupsible-project.git drupal-commerce
Cloning into 'drupal-commerce'...
remote: Counting objects: 685, done.
remote: Compressing objects: 100% (160/160), done.
d 522
Receiving objects: 100% (685/685), 113.64 KiB | 0 bytes/s, done.
Resolving deltas: 100% (365/365), done.
Checking connectivity... done.
@mbarcia
mbarcia / warmly.sh
Last active August 29, 2015 14:23 — forked from thomasfr/warmly.sh
#!/bin/bash
# warmly.sh
# A wget based, easy, poor man`s cache warmer script
# Originally forked from
# https://gist.github.com/thomasfr/7926314
# No trailing slash
WARMLY_START_URL="${1}"