Skip to content

Instantly share code, notes, and snippets.

View julianfbeck's full-sized avatar
🐳
Whale hello there

Julian Beck julianfbeck

🐳
Whale hello there
View GitHub Profile
@VladislavSmolyanoy
VladislavSmolyanoy / Button.swift
Last active March 31, 2025 04:52
Pretty Button Styling for macOS Apps (from SwiftyLaunch)
// Source: SwiftyLaunch
import SwiftUI
let commonButtonRadius = 7.5
let commonButtonHeight = 35.0
let commonButtonFontStyle: Font = .system(.title3, weight: .semibold)
public struct CTAButtonStyle: ButtonStyle {
private let disabled: Bool
@trvswgnr
trvswgnr / compress_video
Last active December 7, 2025 13:00
portable shell script to compress videos with ffmpeg
#!/bin/sh
print_usage() {
echo "usage: compress_video <input_file>"
echo "supported formats: mp4, webm, mkv, mov, avi, flv"
}
get_extension() {
f="${1##*/}"
case "$f" in
@rstacruz
rstacruz / get_kv.ts
Created March 6, 2023 06:59
Using miniflare for Cloudflare Worker KV in Astro
import { getRuntime } from "@astrojs/cloudflare/runtime";
import type { KVNamespace } from "@cloudflare/workers-types";
/** The KV key (eg, env["KV"]) */
const KV_KEY = "KV" as const;
/**
* Returns a Cloudflare Worker KV store.
* In dev, it returns a mock one based on Miniflare.
*/
@djfarrelly
djfarrelly / index.ts
Created October 26, 2022 17:32
Inngest Cloudflare Workers Support (w/ [email protected])
import { createFunction } from "inngest"; // v0.6.1
import { serve } from "inngest/cloudflare";
/**
* Inngest serve requires "node_compat = true" to be set in your wrangler.toml
*
* Set INNGEST_SIGNING_KEY in your wrangler.toml environment variables.
* Get this key in your Inngest dashboard: https://app.inngest.com/secrets
*/
use std::{
fs::File,
io::{Read, Write},
time::Instant,
};
use tokio::task::{self, JoinHandle};
async fn compute() {
let handles: Vec<JoinHandle<_>> = (0..1000)
.map(|_| {
@niklaskorz
niklaskorz / goroutines.go
Last active May 5, 2023 09:51
Threading Performance Comparison
package main
import (
"fmt"
"os"
"runtime"
"sync"
"time"
)
@Lenart12
Lenart12 / music_bot_example.py
Last active November 11, 2024 14:19 — forked from guac42/music_bot_example.py
A simple music bot written using discord.py rewrite and youtube_dl.
# -*- coding: utf-8 -*-
"""
Copyright (c) 2019 Valentin B.
A simple music bot written in discord.py using youtube-dl.
Though it's a simple example, music bots are complex and require much time and knowledge until they work perfectly.
Use this as an example or a base for your own bot and extend it as you want. If there are any bugs, please let me know.
Requirements:
Python 3.5+
pip install -U discord.py pynacl youtube-dl
esphome:
name: esp32_2
platform: ESP32
board: lolin32
wifi:
ssid: !secret ssid_iot
password: !secret password_iot
manual_ip:
static_ip: 192.168.0.111
esphome:
name: esp32_1
platform: ESP32
board: lolin32
wifi:
ssid: !secret ssid_iot
password: !secret password_iot
manual_ip:
static_ip: 192.168.0.110
@bizmate
bizmate / main.tf
Created August 24, 2017 13:13
Getting terraform to ssh and run remote commands
provider "aws" {
access_key = "${var.aws_access_key}"
secret_key = "${var.aws_secret}"
region = "${var.region}"
}
resource "aws_key_pair" "auth" {
key_name = "${var.key_name}"
public_key = "${file(var.public_key_path)}"
}