Skip to content

Instantly share code, notes, and snippets.


Valentin Letourneur atrakeur

View GitHub Profile
atrakeur / ntp.lua
Created Apr 2, 2019
Lua ESP8266 convenience libraries
View ntp.lua
ntpOnSuccess = function () end
function ntpStart(onSuccess, onError)
ntpOnSuccess = onSuccess
function(sec, usec, server, info)
print("SNTP SYNCED")
rtctime.set(sec, usec)
View errors.js
export default {
"default": "Something went wong, please try again later. If the problem persist, please contact support team.",
"network": {
"default": "Network error, maybe your connection is down. Please try again later.",
"api": {
"default": "Something is wrong on our side, please try again later. If the problem persist, please contact support team",
"400": {
"default": "$t(errors.api.default)",
atrakeur / .zshrc
Created Dec 12, 2018
Auto load ssh key for all prompts on first prompt open. Also ask passphrase on first load
View .zshrc
echo "Loading ssh file"
# Ssh-agent Settings
export SSH_AGENT_PID=$(pgrep ssh-agent | head -1)
SSH_AUTH_SOCK=$(ls -1 /tmp/ssh-*/* 2>/dev/null | head -n 1 )
if [[ $(pgrep ssh-agent) == "" ]]; then
rm -r /tmp/ssh-* &> /dev/null;
eval $($SSHAGENT -s)
ssh-add ${KEY}
atrakeur / agnoster.zsh-theme
Created Dec 12, 2018
A modded agnoster theme that speed up prompt time from +1 sec down to 0.20
View agnoster.zsh-theme
# vim:ft=zsh ts=2 sw=2 sts=2
# agnoster's Theme -
# A Powerline-inspired theme for ZSH
# In order for this theme to render correctly, you will need a
# [Powerline-patched font](
atrakeur / app.js
Last active Mar 23, 2016
Sample code on how a website can hide page loading to look a lot faster. Full blog post here:
View app.js
//Configure pjax
new Pjax({
elements: "a", //Quel type d'élément binder pjax (les liens)
selectors: ["title", ".mainContent", ".top-nav-menu"], //Quels parties du html doivent changer entre les pages
//Configure NProgress
minimum: 0.1,
rickleRate: 0.2,
View Brain.c
#include "Origo.h"
#include "Brain.h"
int Brain::addModule(AbstractBrain * module)
DEBUG_PRINT("Brain: Adding module ");
View PingHCSR04.ino
//Define the echo pin (receive the echo from the ultrasound)
//Define the trig pin (trigger the ultrasonic emitter)
//On some sort of sensors, echo and trig can be on the same pin
//Precalculate some values
const float SpeedOfSound = 343.2; // ~speed of sound (m/s) in air, at 20°C
const float MicrosecondsPerMillimetre = 1000.0 / SpeedOfSound; // microseconds per millimetre
const float MicrosecondsToMillimetres = (1.0 / MicrosecondsPerMillimetre); //distance by time elapsed
View FlashingEsp8266.cpp
#define RST_PIN 8 //Reset pin
#define CHPD_PIN 9 //CHPD pin
#define GPIO_PIN 10 //Flashmode pin
void setup() {
//Open serial
//Set pin modes on arduino
atrakeur / HelloWorldEsp8266.ino
Last active Mar 15, 2016
Sample code to start using an esp8266 from an arduino. See full blog post on
View HelloWorldEsp8266.ino
#define RST_PIN 8
#define CHPD_PIN 9
#define DISP_PIN 13
void setup() {
//Ouvre le serial vers le pc (serial) et vers l'esp (serial1)
//Leonardo: On attend l'ouverture du serial sur le pc avant de continuer
atrakeur / php7.php
Created Dec 5, 2015
PHP 7 example of a static typed function
View php7.php
function multiply(int a, int b) : float {
return a * b;
You can’t perform that action at this time.