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 macOS is in dark mode | |
| # Returns "Dark" if dark mode is on, nothing if light mode | |
| DARK_MODE=$(defaults read -g AppleInterfaceStyle 2>/dev/null) | |
| # Path to the active color config file | |
| COLOR_FILE="$HOME/.config/alacritty/color.toml" | |
| if [ "$DARK_MODE" = "Dark" ]; then |
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 "dotenv/config"; | |
| import { dot, norm, add, subtract } from "mathjs"; | |
| import OpenAI from "openai"; | |
| const openai = new OpenAI({ apiKey: process.env.OPENAI_KEY }); | |
| function cosineSimilarity(array1, array2) { | |
| const dotProduct = dot(array1, array2); | |
| const normA = norm(array1); | |
| const normB = norm(array2); | |
| const cosineSimilarity = dotProduct / (normA * normB); |
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/env ruby | |
| # require 'sqlite3' | |
| require 'shellwords' | |
| require 'json' | |
| require 'csv' | |
| # require 'pry' | |
| def tasks_to_csv(sqlite3_path, dest_path) | |
| query = 'select TASK.*, AREA.title as areaTitle, PROJECT.title as projectTitle, HEADING.title as headingTitle' |
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
| const fs = require("fs"); | |
| if (!fs.existsSync("package.json")) { | |
| console.error( | |
| "Cannot find package.json. Please run this script in your project directory." | |
| ); | |
| process.exit(1); | |
| } | |
| const package = fs.readFileSync("package.json", "utf8"); |
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
| 11-2-9=0 | |
| 11-3-8=0 | |
| 11-4-7=0 | |
| 11-5-6=0 | |
| 11-6-5=0 | |
| 11-7-4=0 | |
| 11-8-3=0 | |
| 11-9-2=0 | |
| 12-2*6=0 | |
| 12-3-9=0 |
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 { Fragment, useEffect } from "react"; | |
| import { | |
| useProducts, | |
| useSubscriptions, | |
| useStripeRole, | |
| visitPortal, | |
| useCreateCheckoutSession, | |
| } from "hooks/useStripe"; |
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
| paths = Dir.glob("*.jpg") | |
| `mkdir -p cropped` | |
| paths.sort.each_with_index{|path, i| | |
| cropped_path = "cropped/#{i.to_s.rjust(2, "0")}.jpg" | |
| starting_width = 3834 | |
| starting_height = 5751 | |
| width = starting_width | |
| height = starting_width |
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 React from "react"; | |
| import useMousetrap from "./hooks/useMousetrap"; | |
| export default function Example(){ | |
| useMousetrap({ | |
| a: () => console.log("you pressed a"), | |
| "ctrl+space": () => console.log("you pressed ctrl+space"); | |
| }); | |
| return "lol hi"; | |
| } |
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 Cocoa | |
| import AVFoundation | |
| // inspiration: https://www.youtube.com/watch?v=1_PUdhLQsZQ | |
| class ViewController: NSViewController { | |
| @IBOutlet weak var videoView: NSView! | |
| private var cameraSession = AVCaptureSession() | |
| private var camera: AVCaptureDevice! |
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 sublime | |
| import sublime_plugin | |
| import re | |
| import os | |
| class OpenJournalReferencedOnThisLineCommand(sublime_plugin.TextCommand): | |
| def run(self, edit): | |
| region = self.view.sel()[0] | |
| line_range = self.view.line(region) | |
| line = self.view.substr(line_range) |
NewerOlder