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 re | |
from datetime import datetime, timedelta, date | |
class Timestamp: | |
""" | |
A representation of a timestamp parsed from Org mode. | |
""" | |
def __init__(self, timestamp_str): | |
self.timestamp_str = timestamp_str | |
self.start_date = None |
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 whisper | |
import pyaudio | |
import wave | |
import sys | |
import tempfile | |
from ctypes import * | |
# Load the Whisper model once | |
model = whisper.load_model("base.en") |
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
// RUN THIS AT <https://protonvpn.com/vpn-servers/> | |
SELECTOR = "#collapseNLfree > div:nth-child(1) > ul:nth-child(1) > .list-group-item"; // Change this to change the servers listed, this defaults to the Netherlands free servers | |
// As Proton change their website design, this will likely need to be changed | |
freeServers = document.querySelectorAll(SELECTOR); | |
loads = Array.from(freeServers).map(elem => { | |
const [name, load] = elem.innerText.split("Load "); | |
return name.trim() + ": " + load.trim(); |
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
// All our changes occur here | |
#[component(App<G>)] | |
fn app() -> Template<G> { | |
let root_ref = NodeRef::new(); | |
template! { | |
// The router will use `root_ref`, so it needs to be `move` to avoid lifetime errors | |
Router(RouterProps::new(HistoryIntegration::new(), /* NEW START */ move /* NEW END */ |route: StateHandle<Routes>| { | |
// Template interpolation is the problem, so we get rid of it | |
// let template = Signal::new(Template::empty()); // OLD |
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
// This file contains a temporary fix for the issues with recursive extraction in `include_dir` | |
// Tracking issue is https://github.com/Michael-F-Bryan/include_dir/issues/59 | |
use std::path::Path; | |
use include_dir::Dir; | |
use std::io::Write; | |
/// Extracts a directory included with `include_dir!` until issue #59 is fixed on that module (recursive extraction support). | |
pub fn extract_dir<S: AsRef<Path>>(dir: Dir, path: S) -> std::io::Result<()> { | |
let path = path.as_ref(); |
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 | |
containername=$1 | |
# Feed the list of currently running containers into an Awk script that declares the container name a variable and then gets the outputs of running it as a regex pattern, printing the first word | |
id=$(docker ps | awk -v containername="$containername" '$0 ~ containername{print $1}'); | |
# Check if there is an image ID or not | |
if [[ -z $id ]]; then | |
echo "No images match that pattern. Try broadening your search, you can enter regex patterns to this command to if you'd like, but be aware of Awk syntax."; | |
else | |
echo "$id"; |
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
# Setup Stage - set up the ZSH environment for optimal developer experience | |
FROM alpine:latest AS setup | |
# Let scripts know we're running in Docker (useful for containerised development) | |
ENV RUNNING_IN_DOCKER true | |
# Use the unprivileged `main` user (created without a password ith `-D`) for safety | |
RUN adduser -D main | |
RUN mkdir -p /app \ | |
&& chown -R main:main /app | |
# Set up ZSH and our preferred terminal environment for containers | |
RUN apk --no-cache add zsh curl git |
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
# Setup Stage - set up the ZSH environment for optimal developer experience | |
FROM node:14-alpine AS setup | |
# Let scripts know we're running in Docker (useful for containerised development) | |
ENV RUNNING_IN_DOCKER true | |
# Use the unprivileged `node` user (pre-created by the Node image) for safety (and because it has permission to install modules) | |
RUN mkdir -p /app \ | |
&& chown -R node:node /app | |
# Set up ZSH and our preferred terminal environment for containers | |
RUN apk --no-cache add zsh curl git | |
RUN mkdir -p /home/node/.antigen |
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
# Note: for this to do anything, use my starter Dockerfile config (https://gist.github.com/arctic-hen7/10987790b86360820e2790650e289f0b) | |
# This file contains ZSH configuration for your shell when you interact with a container | |
# (we wouldn't want any boring `sh` now would we?) | |
# Please feel free to set up your own ZSH config in here! | |
# It gets mapped to your `.zshrc` for the root user in the container | |
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc. | |
# Initialization code that may require console input (password prompts, [y/n] | |
# confirmations, etc.) must go above this block; everything else may go below. |