Skip to content

Instantly share code, notes, and snippets.

View jrialland's full-sized avatar

Julien Rialland jrialland

View GitHub Profile
@jrialland
jrialland / facemesh.py
Created October 30, 2023 13:40
python opencv example
from cvzone.FaceMeshModule import FaceMeshDetector
import cv2
cap = cv2.VideoCapture(0)
detector = FaceMeshDetector(maxFaces=2)
while True:
success, img = cap.read()
img, faces = detector.findFaceMesh(img)
if faces:
print(faces[0])
@jrialland
jrialland / CMakeLists.txt.snippet
Last active April 14, 2023 10:09
Cmake snippet that compiles quickjs as static library
################################################################################
## compile quickjs as a static library
set(QUICKJS_GIT_TAG master)
include(FetchContent)
FetchContent_Declare(
quickjs
GIT_REPOSITORY https://github.com/bellard/quickjs.git
GIT_TAG ${QUICKJS_GIT_TAG}
@jrialland
jrialland / add_cert.sh
Created February 13, 2023 09:27
install a certificate bundle containing multiple certs as trusted certificates
#ADD data/ca-bundle.crt /usr/share/ca-certificates/mycompany/ca-bundle.crt
#RUN << EOF
cd /usr/share/ca-certificates/mycompany
i=1; while openssl x509 -out cert$i.pem; do
echo mycompany/cert$i.pem >> /etc/ca-certificates.conf
i=$((i+1))
done < ca-bundle.crt
update-ca-certificates
#EOF
@jrialland
jrialland / FindLEMON.cmake
Created August 30, 2022 12:39
CMake script for lemon parser generator
# - Find lemon executable and provides macros to generate custom build rules
# The module defines the following variables:
#
# LEMON_EXECUTABLE - path to the LEMON program
# LEMON_VERSION - version of LEMON
# LEMON_FOUND - true if the program was found
#
# If LEMON is found, the module defines the macro:
#
# LEMON_TARGET(<Name> <LEMONInp>)
#include <ESP8266WiFi.h>
extern "C" {
#include "user_interface.h"
#include "wpa2_enterprise.h"
#include "c_types.h"
}
// SSID to connect to
char ssid[] = "TEST_KRA";
import sys, traceback, logging, json
from flask import Flask, request, Response, url_for
class JsonRpc:
def __init__(self, server, save_js_to=None):
self.server = server
self.endpoints = {}
self.services = {}
self.save_js_to = save_js_to
from flask import Flask, request, Response
from shelljob import proc
app = Flask(__name__)
@app.route('/tts/<lang>.mp3')
def text_to_speech(lang):
text = request.args.get('text')
g = proc.Group()
p = g.run(['bash', '-c', 'espeak-ng -v mb-fr1 -q --pho "'+text+'" | mbrola -t 1.2 -f 1.0 /usr/share/mbrola/fr1/fr1 - -.au' + "|ffmpeg -i 'pipe:0' -vn -ar 16000 -ac 1 -b:a 48k -f mp3 'pipe:1'"])
import ctypes, subprocess, sys
def elevate():
if ctypes.windll.shell32.IsUserAnAdmin():
return
else:
class ShellExecuteInfo(ctypes.Structure):
_fields_ = [('cbSize', ctypes.wintypes.DWORD),
('fMask', ctypes.c_ulong),
('hwnd', ctypes.wintypes.HWND),
package com.demo.rpc;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
#include <AppCore/App.h>
#include <AppCore/Window.h>
#include <AppCore/Overlay.h>
#include <AppCore/JSHelpers.h>
#include <iostream>
#include <Ultralight/Ultralight.h>
#include <spdlog/spdlog.h>
#include <SFML/Window/VideoMode.hpp>
#include "ui_def.hpp"