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
#include <iostream> | |
#include <thread> | |
#include <termios.h> | |
#include <unistd.h> | |
void processKeyboardInput() { | |
termios original_settings, new_settings; | |
tcgetattr(STDIN_FILENO, &original_settings); | |
new_settings = original_settings; | |
new_settings.c_lflag &= ~ICANON; |
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 subprocess | |
def rename_pdfs(directory): | |
"""Iterates through PDFs in a directory, opens them, and renames them with user input.""" | |
pdf_files = [f for f in os.listdir(directory) if f.endswith(".pdf")] | |
for filename in pdf_files: | |
pdf_path = os.path.join(directory, filename) |
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 random | |
import csv | |
def rim(): | |
return random.randint(0, 2**32 - 1) | |
def write_to_csv(data, filename): | |
with open(filename, "w", newline="") as csvfile: | |
writer = csv.writer(csvfile) | |
writer.writerows(data) |
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
#!/bin/bash | |
: ' Setup | |
Put script in dir with HEIC images | |
Install imagemagick: sudo apt install imagemagick | |
Allow larger cache | |
- sudo nano /etc/ImageMagick-6/policy.xml | |
- change <policy domain="resource" name="disk" value="1GiB"/> |
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
from pyray import * | |
import math | |
show_instruction = True | |
cone_deg_half = 25 | |
heading = 340 | |
window_size = Vector2(800, 500) | |
text_size = int(window_size.y / 20) | |
center = Vector2(window_size.x / 2, window_size.y / 2) |
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
/* | |
Portenta - DirList | |
The sketch shows how to mount an usb storage device and how to | |
get a list of the existing folders and files. | |
The circuit: | |
- Portenta H7 | |
This example code is in the public domain. |
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
from PIL import Image, ImageDraw, ImageFont | |
import os | |
filelist = os.listdir(".") | |
filelist.sort() | |
jpglist = [] | |
for filename in filelist: | |
if filename[0] == "g": | |
jpglist.append(filename) |
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
from pyray import * | |
import csv | |
# Constants | |
start_wid = 800 | |
start_hgt = 600 | |
debug = True | |
def lerp(v1: Vector2, v2: Vector2, ratio: float): |
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
#include "PluggableUSBMSD.h" | |
#include "QSPIFBlockDevice.h" | |
#include "MBRBlockDevice.h" | |
#include "FATFileSystem.h" | |
REDIRECT_STDOUT_TO(Serial) | |
static QSPIFBlockDevice root; | |
mbed::MBRBlockDevice fs_data(&root, 1); | |
static mbed::FATFileSystem fs("fs"); | |
void USBMSD::begin() { |
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
internal class Focus | |
{ | |
public string ElapsedTime; | |
public Bitmap ScaledImage; | |
private int ScanSize, Width, Height; | |
private const double ImageScaling = 0.2; | |
private const int GridSize = 20; // N x N grid | |
private const double DataPercentage = 0.2; // Highest % of available data from training grid | |
private int[] Tiles; | |
private double[] Scores; |
NewerOlder