Skip to content

Instantly share code, notes, and snippets.

@Eveeifyeve
Eveeifyeve / main.rs
Last active September 6, 2024 12:15
Rust impl_trait Optional
trait Optional<T>: Into<Option<T>> {}
impl<T> Optional<T> for T where T: Into<Option<T>> {}
impl<T> Optional<T> for Option<T> {}
fn test<T: Optional<bool>>(test_type: T) -> bool {
let test_type = match test_type.into() {
Some(test) => test,
@Eveeifyeve
Eveeifyeve / deleteScreenshots.py
Created February 10, 2024 09:37
deleteShotsPyScrpt
import os
# Set the target directory
target_directory = os.path.expanduser('~/documents/screenshots')
# Loop through all files in the target directory
for filename in os.listdir(target_directory):
# Check if the file ends with the extensions we want to delete
if filename.endswith('.png') or filename.endswith('.jpg') or filename.endswith('.jpeg'):
# Construct full file path
@Eveeifyeve
Eveeifyeve / apps.txt
Last active August 10, 2024 13:26
reinstallAppsPyScrpt
cmake
bun
gh
gradle
jenv
neovide
neovim
raycast
spicetify-cli
tmux
@Eveeifyeve
Eveeifyeve / gitBackup.py
Last active August 10, 2024 13:16
backup-reposPyScrpt
import os
import subprocess
def is_git_repo(path):
return os.path.exists(os.path.join(path, '.git'))
def backup_and_push(path):
if is_git_repo(path):
print(f"Backing up {path}...")
subprocess.run(['git', '-C', path, 'add', '.'])
@Eveeifyeve
Eveeifyeve / drizzleBun.ts
Last active August 10, 2024 13:16
drizzle x bun-sql
import { text, integer } from "drizzle-orm/sqlite-core";
import { sqliteTable } from "drizzle-orm/sqlite-core";
import { drizzle } from "drizzle-orm/bun-sqlite";
import { Database } from "bun:sqlite";
export const user = sqliteTable('user', {
id: integer('userId').primaryKey(),
username: text('username').notNull(),
})