This file contains hidden or 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 concurrent.futures | |
| def first_completed(f, args, num_workers=10): | |
| executor = concurrent.futures.ThreadPoolExecutor(max_workers=num_workers) | |
| try: | |
| futures = [executor.submit(f, *arg) for arg in args] | |
| ret = None | |
| for future in concurrent.futures.as_completed(futures): | |
| ret = future.result() |
This file contains hidden or 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 pygame | |
| import math | |
| pygame.init() | |
| SIZE = WIDTH, HEIGHT = (1024, 720) | |
| FPS = 30 | |
| screen = pygame.display.set_mode(SIZE, pygame.RESIZABLE) | |
| clock = pygame.time.Clock() |
This file contains hidden or 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 | |
| # | |
| # Transform a presentation with animations in a pdf by automatically clicking and screenshotting | |
| # | |
| presentation_window_name="WPS Presentation Slide Show" | |
| output_file="presentation.pdf" | |
| tmp_folder="./presentation-to-pdf-tmp" | |
| click_delay=0.2 | |
| trim=1 |
This file contains hidden or 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 | |
| # shellcheck source=/dev/null | |
| # Example: | |
| # Freeze and delete virtualenvs folders older than 100 days: | |
| # | |
| # find ./ -maxdepth 1 -type d -mtime +100 -print | ./virtualenvs_cleanup.sh | |
| # | |
| REQUIREMENTS_FILE="requirements.bak.txt" |
This file contains hidden or 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 | |
| # ./project-flattner.sh <source folder> <destination folder> | |
| # | |
| # Some Editorial Management System require LaTeX sources submissions to be on the same folder level. | |
| # This script takes a folder with a project with multiple folders and subfolders and | |
| # | |
| # 1) copies all the files from the source folder to the destination one | |
| # renaming all of them from "path/to/file.ext" to "path_to_file.ext" | |
| # 2) sobsitutes in all the new files all the occurences of |
This file contains hidden or 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 sys | |
| import time | |
| import argparse | |
| import string | |
| chars = string.ascii_lowercase | |
| parser = argparse.ArgumentParser() | |
| parser.add_argument("--constant", type=str, choices=["pi", "phi"], default="pi") |
This file contains hidden or 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 sys | |
| import time | |
| import argparse | |
| import string | |
| chars = string.ascii_lowercase | |
| parser = argparse.ArgumentParser() | |
| parser.add_argument("--constant", type=str, choices=["pi", "phi"], default="pi") |
This file contains hidden or 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 torch | |
| from torch.nn import functional as F | |
| from torch.utils.data import DataLoader | |
| from torchvision.datasets import MNIST | |
| from torchvision import transforms | |
| from argparse import ArgumentParser | |
| from pytorch_lightning import Trainer |
This file contains hidden or 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/bash | |
| KEYBOARD="HID 04f3:074d" | |
| MODE="pc" | |
| pc_mode() { | |
| killall florence | |
| set_layout "it" | |
| } |
This file contains hidden or 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
| # Wizardpen configuration for "Magicart75" Graphic Tablet | |
| # xinput name: EMRight Technology Co. Graphic Tablet | |
| # USB Vendor ID: 2c68 | |
| # USB Product ID: e003 | |
| Section "InputClass" | |
| Identifier "wizardpen" | |
| MatchIsTablet "on" | |
| MatchDevicePath "/dev/input/event*" | |
| MatchProduct "EMRight" |
NewerOlder