This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import subprocess | |
import io | |
import cv2 | |
class FfmpegVideo(): | |
def __init__(self, output_path, framerate=30): | |
self.output_path = output_path | |
self.closed = False | |
self.ffmpeg_proc = subprocess.Popen(f"ffmpeg -y -loglevel error -framerate {framerate} -f image2pipe -c:v mjpeg -i - -c:v libx264 -b:v 10M -preset ultrafast -r {framerate} {output_path}", shell=True, stdin=subprocess.PIPE)#, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Barometric flight controller by RedBlaze (ESTACA-SiERA) | |
# You need the bmp280 library available here: https://github.com/dafvid/micropython-bmp280/blob/83dfdd6dff6382c7aff03138d32ae48d00ec729a/bmp280.py | |
import machine, neopixel, bmp280, time | |
import _thread | |
from machine import Pin, I2C, Timer | |
from micropython import const | |
from collections import deque | |
import rp2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
std::atomic_bool revoxelizing = false; | |
void revoxelize(LBM* lbm, Mesh* mesh) { // voxelize new frames in detached thread in parallel while LBM is running | |
for(uint n=0u; n<lbm->get_N(); n++) lbm->flags[n] &= ~TYPE_S; // clear flags | |
const float3x3 rotation = float3x3(float3(0.0f, 1.0f, 0.0f), radians(0.8f)); // create rotation matrix to rotate mesh | |
mesh->rotate(rotation); // rotate mesh | |
voxelize_mesh_hull(*lbm, mesh, TYPE_S); // voxelize rotated mesh in lbm.flags | |
revoxelizing = false; // indicate new voxelizer thread has finished | |
} | |
void main_setup() { // Rotating rocket | |
// ######################################################### define simulation box size, viscosity and volume force ############################################################################ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import plotly.express as px | |
from datetime import datetime | |
dates_str = ["21/07/1998", "21/08/1998", "21/09/1998", "21/10/1998", "21/11/1998", "21/12/1998"] # X | |
valeurs = [1, 2, 3, 3, 2, 1] # Y | |
# %d = jour du mois 00-31 | |
# %m = mois de l'année 00-12 | |
# %Y = année en 4 chiffres 0000-9999 | |
format_date = "%d/%m/%Y" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import plotly.graph_objects as go | |
import dash | |
from dash import dcc | |
from dash.dependencies import Input, Output | |
from dash import html | |
from functools import partial | |
import serial | |
class LiveGraph(): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class JsonConfig(): | |
def __init__(self, filepath): | |
self.last_timestamp_loaded = None | |
self.file = None | |
if not os.path.exists(filepath): | |
with open(filepath, "w") as f: json.dump({}, f) | |
print(filepath, os.path.exists(filepath)) | |
self.filepath = filepath | |
self.lockpath = f"{filepath}.lock" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2, imutils | |
from imutils.video import VideoStream | |
from os import path | |
import os | |
from shutil import copy | |
import time, tqdm | |
import pickle | |
def digit(input,nb): | |
output=str(input) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import random | |
path="music/" | |
files = [f for f in os.listdir(path) if os.path.isfile(os.path.join(path, f))] | |
print("Nombre de musiques: {}".format(len(files))) | |
random.shuffle(files) | |
data="\n".join(["file '{}{}'".format(path,file) for file in files]) | |
with open("list.txt","w") as concat_file: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"start": { | |
"prefix": "startC", | |
"scope": "c", | |
"body": [ | |
"#include<stdlib.h>", | |
"#include<stdio.h>", | |
"", | |
"int main(){", | |
" $1", | |
"}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from stat import S_ISREG, ST_CTIME, ST_MODE | |
import os, sys, time | |
def digit(input,nb): | |
output=str(input) | |
while(len(output)<nb): | |
output="0"+output | |
return output |
NewerOlder