Skip to content

Instantly share code, notes, and snippets.

Avatar

Raphael Yancey raphaelyancey

View GitHub Profile
@raphaelyancey
raphaelyancey / ezmail.sh
Last active Feb 4, 2020
One-line SMTP send with curl
View ezmail.sh
#!/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 Apr 11, 2019
Example logging dictConfig for Python / Django and colorlog for colored logs
View colorlog-django.py
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 Jun 28, 2017
One-liner quickly to mount RaspberryPi /home folder for remote editing
View raspberry-pi-nfs-mount.sh
# 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...)
View robot-poulpe-gueridon.ino
// 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 Apr 30, 2015
Absolutely! WYSIWYG positionning (fork)
View absolutely-fork.js
// 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 Aug 29, 2015
Git post-receive deployment script
View post-receive
#!/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 Aug 29, 2015
Stripped parameters Google search plugin in Firefox (OSX)
View .bash_profile
# 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 Aug 29, 2015
Stripped parameters Google search plugin file for Firefox
View google.xml
<!-- 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