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 'dart:math'; | |
enum AppRoute { root, login, welcome } | |
void main() { | |
final randomNumberGenerator = Random(); | |
final isAuthenticated = randomNumberGenerator.nextBool(); | |
final hasSeenWelcome = randomNumberGenerator.nextBool(); | |
final initialLocation = isAuthenticated |
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 | |
# Check if an argument is provided | |
if [ -z "$1" ]; then | |
echo "Usage: $0 <bitrate>" | |
exit 1 | |
fi | |
# Store the original settings.json | |
mv settings.json settings_orig.json |
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 'package:flutter/material.dart'; | |
import 'dart:math'; | |
void main() { | |
runApp(const CardGameApp()); | |
} | |
class CardGameApp extends StatelessWidget { | |
const CardGameApp({super.key}); |
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 'package:flutter/material.dart'; | |
void main() { | |
runApp(const MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
const MyApp({super.key}); | |
@override |
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 bluetooth | |
import sys | |
if len(sys.argv) != 2: | |
print(f"usage: {sys.argv[0]} <message>") | |
sys.exit(1) | |
message = sys.argv[1] | |
nearby_devices = bluetooth.discover_devices( |
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 requests | |
PRINTER_DEVICE = "/dev/usb/lp0" | |
with open(PRINTER_DEVICE, "wb") as printer: | |
response = requests.get("https://zenquotes.io/api/random") | |
response.raise_for_status() | |
data = response.json() | |
if data and isinstance(data, list) and len(data) > 0: | |
quote_data = data[0] | |
quote = quote_data.get("q") |
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
#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 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 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 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 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 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 | |
: ' 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"/> |
NewerOlder