Skip to content

Instantly share code, notes, and snippets.

View sebastienserre's full-sized avatar
🏠
Working from home

Sébastien SERRE sebastienserre

🏠
Working from home
View GitHub Profile
blueprint:
name: Aqara TRV E1 external temperature
description: >
Configures the Aqara TRV to receive it's temperature from an external sensor.
Every time the temperature sensor value cahnges it's is send to the TRV.
domain: automation
source_url: "https://gist.github.com/pavax/8d6ed250765d89cb281d4a1762b8d2e8"
input:
external_temp_sensor:
name: External temperature sensor
sebastien@sebastien-desktop:~$ ssh -vv defr9012@delaware.o2switch.net
OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n 7 Dec 2017
debug1: Reading configuration data /home/sebastien/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: resolving "delaware.o2switch.net" port 22
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to delaware.o2switch.net [109.234.162.115] port 22.
debug1: Connection established.
debug1: identity file /home/sebastien/.ssh/id_rsa type 0
function get_lat_lng( $address ) {
$address = rawurlencode( $address );
$coord = get_transient( 'geocode_' . $address );
if( empty( $coord ) ) {
$url = 'http://nominatim.openstreetmap.org/?format=json&addressdetails=1&q=' . $address . '&format=json&limit=1';
$json = wp_remote_get( $url );
if ( 200 === (int) wp_remote_retrieve_response_code( $json ) ) {
$body = wp_remote_retrieve_body( $json );
$json = json_decode( $body, true );
}
This file has been truncated, but you can view the full file.
Attaching to stjean_database_1
database_1 | chmod: changing permissions of '/helpers/add-cert.sh': Operation not permitted
database_1 | chmod: changing permissions of '/helpers/auth.sh': Operation not permitted
database_1 | chmod: changing permissions of '/helpers/binding.sh': Operation not permitted
database_1 | chmod: changing permissions of '/helpers/generate-key.sh': Operation not permitted
database_1 | chmod: changing permissions of '/helpers/get-remote-url.sh': Operation not permitted
database_1 | chmod: changing permissions of '/helpers/lando-entrypoint.sh': Operation not permitted
database_1 | chmod: changing permissions of '/helpers/load-keys.sh': Operation not permitted
database_1 | chmod: changing permissions of '/helpers/mounter.sh': Operation not permitted
database_1 | chmod: changing permissions of '/helpers/pantheon.sh': Operation not permitted
@sebastienserre
sebastienserre / add-sitemaps.php
Created October 26, 2018 09:54
Example of code to add a dynamic url for sitemaps in WP multisite / Multidomain
add_filter( 'robots_txt', 'thfo_add_sitemaps');
function thfo_add_sitemaps( $output ){
$sitemap_url = 'sitemap: ' . get_bloginfo('url') . '/sitemap.xml';
$output .= $sitemap_url;
return $output;
}
public function compare_register_prod() {
error_log( 'start Import' );
//$truncat = $wpdb->query( 'DELETE FROM ' . $table . ' WHERE `platform` LIKE "Awin"' );
$partners = $this->awin['partner'];
$partners = explode( ',', $partners );
$secondes = apply_filters( 'compare_time_limit', 600 );
@sebastienserre
sebastienserre / disable-gutenberg-callout.php
Last active August 9, 2018 15:28
Disable Gutenberg Callout
<?php
/*
Plugin Name: Disable Gutenberg Callout
Plugin URI: https://www.thivinfo.com
Description: Disable the Gutenberg Callout added in WordPress 4.9.8
Author: Sébastien SERRE
Author URI: https://thivinfo.com
Version: 1.0.0
*/
/*
@sebastienserre
sebastienserre / gist:f9f42b947cb05391bf08ae20a64b8f51
Last active March 22, 2018 07:16
Correct date format before importing with WP ALL Import
/**
* correct Date in XML from Pericles fr-> en
*/
function thfo_correct_date($biens) {
$date = explode( '/', $biens->DATE_MODIF );
$date = $date[2] . '/' . $date[1] . '/' . $date[0];
$date = date( 'Y/m/d', strtotime( $date ) );
@sebastienserre
sebastienserre / extract_zip.php
Created March 20, 2018 06:44
This Gist unzip file before import by the WordPress Plugin WP ALL Import
<?php
/**
* Unzip photo before import by WP ALL Import
*/
function thfo_extract_photo(){
$path = wp_get_upload_dir();
$file = $path['basedir'] . '/wpallimport/files/export.ZIP';
$real_path = $path['basedir'] . '/wpallimport/files/';
@sebastienserre
sebastienserre / functions.php
Created December 27, 2015 17:04
Snippet for WP functions.php
<?php
// add a favicon
function favicon_link() {
echo '<link rel="shortcut icon" type="image/x-icon" href="http://www.thivinfo.com/wp-content/themes/thivinfo_v3/favicon.ico" />' . "\n";
}
add_action( 'wp_head', 'favicon_link' );