Skip to content

Instantly share code, notes, and snippets.

@jerome-labidurie
jerome-labidurie / index.php
Created October 11, 2015 10:07
simple one file php session for login example
<?php
// valid credentials
$valid_user='user';
$valid_password='pwd';
if (isset($_POST['login']) && isset($_POST['pwd'])) {
// trying to log
if ( ($_POST['login'] == $valid_user) and
($_POST['pwd'] == $valid_password) ) {
@jerome-labidurie
jerome-labidurie / index.html
Created October 17, 2015 14:01
Synology SSO server login example
<html>
<head>
<!-- include Synology SSO js -->
<script src="http://ds:5000/webman/sso/synoSSO-1.0.0.js"></script>
</head>
<body>
<script>
/** Display login/logout button.
@jerome-labidurie
jerome-labidurie / serial.c
Created June 1, 2016 23:04
linux serial port writing/reading
#include <stdio.h>
#include <errno.h>
#include <termios.h>
#include <unistd.h>
#include <string.h>
/* source : http://stackoverflow.com/a/6947758 */
int set_interface_attribs (int fd, int speed, int parity) {
struct termios tty;
@jerome-labidurie
jerome-labidurie / index.php
Created June 11, 2017 14:53
small script for thumbnails creation/display
<html>
<head>
<title> static images </title>
</head>
<body>
<pre>
<?php
@jerome-labidurie
jerome-labidurie / esp8266_deepsleep.ino
Created January 29, 2019 10:22
Esp8266 DeepSleep & RTC memory save example
/* Deep Sleep - Blink
*
* Blinks the onboard LED, sleeps for 10 seconds and repeats
*
* Connections:
* D0 -- RST
*
* If you cant reprogram as the ESP is sleeping, disconnect D0 - RST and try again
*/
@jerome-labidurie
jerome-labidurie / tk_img_btn.py
Created March 5, 2019 17:21
un bouton avec une image en python tkinter
#!/usr/bin/env python3
# doc : http://infohost.nmt.edu/tcc/help/pubs/tkinter/web/index.html
import tkinter as tk
class Application(tk.Frame):
def __init__(self, master=None):
super().__init__(master)
self.master = master
@jerome-labidurie
jerome-labidurie / tk_grid.py
Created March 11, 2019 21:41
une grille de boutons et appel de command avec argument
#!/usr/bin/env python3
# fenetre avec grille de boutons
# doc en francais : http://tkinter.fdex.eu/index.html
import tkinter as tk
root = tk.Tk()
root.resizable(False, False)
# affiche un chaine passée en paramètre
@jerome-labidurie
jerome-labidurie / HALegoTrain.ino
Last active May 5, 2024 19:21
Lego PoweredUp control from HomeAssistantt
/**
* Lego (Powered Up) train control from Home Assistant / MQTT with BellRing
*
* Licence: GPLv3
*
* needed libraries:
* legoino https://github.com/corneliusmunz/legoino
* > 1.1.0, tested with commit 4daae4f683b087b8c443a4c813934e3dfff41d69
* home-assistant-integration https://github.com/dawidchyrzynski/arduino-home-assistant
* 1.3.0
@jerome-labidurie
jerome-labidurie / Screenshot_01.png
Last active November 4, 2023 17:45
Dolphin Service Menu for StableDiffusion images
Screenshot_01.png