Skip to content

Instantly share code, notes, and snippets.

View raphaelyancey's full-sized avatar

Raphael Yancey raphaelyancey

View GitHub Profile
@raphaelyancey
raphaelyancey / DS3502.h
Last active May 6, 2022 13:51
ESPHome & Adafruit DS3502 component
#include "esphome.h"
#include <Adafruit_DS3502.h>
Adafruit_DS3502 ds3502 = Adafruit_DS3502();
#define WIPER_VALUE_PIN A0
class DS3502_Component : public Component
{
public:
void setup() override
@raphaelyancey
raphaelyancey / ezmail.sh
Last active February 4, 2020 15:39
One-line SMTP send with curl
#!/bin/bash
# Sends an email with the params:
# - CURL_SMTP_SERVER: SMTP server URL in the form of 'smtp(s)://host:port'
# - CURL_SMTP_FROM: the sender e-mail address
# - CURL_SMTP_TO: the recipient e-mail address
# - CURL_SMTP_USER: the SMTP user (optional)
# - CURL_SMTP_PASSWD: the SMTP user's password (optional — ignored if CURL_SMTP_USER is empty)
#
# Usage:
@raphaelyancey
raphaelyancey / colorlog-django.py
Created April 11, 2019 15:51
Example logging dictConfig for Python / Django and colorlog for colored logs
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'filters': {
},
'formatters': {
'colored': {
'()': 'colorlog.ColoredFormatter', # colored output
# --> %(log_color)s is very important, that's what colors the line
@raphaelyancey
raphaelyancey / raspberry-pi-nfs-mount.sh
Created June 28, 2017 15:45
One-liner quickly to mount RaspberryPi /home folder for remote editing
# Required:
# `sudo apt-get install nfs-kernel-server rpcbind`
# And after that:
# `sudo echo "/home *(rw,all_squash,no_subtree_check,anonuid=1000,anongid=1000,sync,insecure)" >> /etc/exports`
# /!\ WARNING /!\ Totally insecure !
# Use only on your local network, and only if your
# Raspberry Pi is not accessible from the outside!
# (basically, it allows read/write remote mounting of the /home folder without a password...)
// Raphael Yancey <raphael@badfile.net>
// Adami CED 2016
const int NOTE_B2=123;const int NOTE_C3=131;const int NOTE_CS3=139;const int NOTE_D3=147;const int NOTE_DS3=156;const int NOTE_E3=165;const int NOTE_F3=175;const int NOTE_FS3=185;const int NOTE_G3=196;const int NOTE_GS3=208;const int NOTE_A3=220;const int NOTE_AS3=233;const int NOTE_B3=247;const int NOTE_C4=262;const int NOTE_CS4=277;const int NOTE_D4=294;const int NOTE_DS4=311;const int NOTE_E4=330;const int NOTE_F4=349;const int NOTE_FS4=370;const int NOTE_G4=392;const int NOTE_GS4=415;const int NOTE_A4=440;const int NOTE_AS4=466;const int NOTE_B4=494;const int NOTE_C5=523;const int NOTE_CS5=554;const int NOTE_D5=587;const int NOTE_DS5=622;const int NOTE_E5=659;const int NOTE_F5=698;const int NOTE_FS5=740;const int NOTE_G5=784;const int NOTE_GS5=831;const int NOTE_A5=880;const int NOTE_AS5=932;const int NOTE_B5=988;const int NOTE_C6=1047;const int NOTE_CS6=1109;const int NOTE_D6=1175;const int NOTE_DS6=1245;const int NOTE_E6=1319;const int NOTE_F6=1
@raphaelyancey
raphaelyancey / absolutely-fork.js
Created April 30, 2015 11:08
Absolutely! WYSIWYG positionning (fork)
// Javascript
// ----------------------
$(document).ready(function (){
function update_style(el) {
var absolute_info = null;
$('.absolutely_output').empty();
var position = $(el).offset();
var parent = $(el).parent('.step');
@raphaelyancey
raphaelyancey / post-receive
Last active August 29, 2015 14:06
Git post-receive deployment script
#!/bin/sh
# Name of the destination directory
NAME=deploy-test
echo "[+] Deploying..."
git --work-tree=/home/$NAME --git-dir=/home/git/repositories/$NAME.git checkout -f
@raphaelyancey
raphaelyancey / .bash_profile
Last active August 29, 2015 14:06
Stripped parameters Google search plugin in Firefox (OSX)
# Add this to your ~/.bash_profile or ~/.bashrc
# You will need to execute this alias after every Firefox update
# To work offline, juste replace the wget command with a cp of the local file to the same destination
# If you use Firefox Beta or Aurora, just replace the name and don't forget to quote the paths (as there will be a space in the name)
alias firefox-google-fix='curl https://gist.githubusercontent.com/raphaelyancey/d158d662170edcc845fa/raw/8b62e7ba974a11f7b75cb051c3bc3a80a9365dc5/google.xml > /Applications/Firefox.app/Contents/Resources/browser/searchplugins'
@raphaelyancey
raphaelyancey / google.xml
Last active August 29, 2015 14:06
Stripped parameters Google search plugin file for Firefox
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/">
<ShortName>Google</ShortName>
<Description>Google Search</Description>
<InputEncoding>UTF-8</InputEncoding>
<Image width="16" height="16">data:image/x-icon;base64,AAABAAIAEBAAAAAAAAB9AQAAJgAAACAgAAAAAAAA8gIAAKMBAACJUE5HDQoaCgAAAA1JSERSAAAAEAAAABAIBgAAAB/z/2EAAAFESURBVDjLpZNJSwNBEIXnt4lE4kHxovgT9BDwJHqPy0HEEOJBiAuCRg+KUdC4QS4KrpC4gCBGE3NQ48JsnZ6eZ3UOM6gjaePhQU93v6+qq2q0pqgeJj2S8EdJT1hr0OxBtKCD5iEd8QxDYpvhvOBAuMDKURX9C9aPu4GA1GEVkzvMg10UBfYveWAWgYAP00V01fa+R9M2bA51wJvhIn3qR+ybt3D3JNQBE5sMjCIOLFpoHzOwdsLRO22qA6R6kiZiWwxUvy/PUQZIhYZ1vFM9cvcOOsYNdcBgysISdSJBnZjJMlR0Fw8vAp0xoz5gao/h+NZBy4i/10XGwrPA+hmvDyhVRG2Avu/LwcrkFADZa16L1h330w1RNgc3DiJzCpPYRm1bpveXX11clQR28xwblHpk1vq1iP/5mcoS0CoXDZiL0vsJ+dzfl+3T/VYAAAAASUVORK5CYIKJUE5HDQoaCgAAAA1JSERSA