Skip to content

Instantly share code, notes, and snippets.

View thewh1teagle's full-sized avatar
💭
coding

thewh1teagle

💭
coding
  • localhost
  • The martian
View GitHub Profile
[✔] Environment
    - OS: Windows 10.0.22631 X64
    ✔ WebView2: 124.0.2478.97
    ✔ MSVC: Visual Studio Community 2022
    ✔ rustc: 1.77.1 (7cf61ebde 2024-03-27)
    ✔ cargo: 1.77.1 (e52e36006 2024-03-26)
    ✔ rustup: 1.27.0 (bbb9276d2 2024-03-08)
    ✔ Rust toolchain: stable-x86_64-pc-windows-msvc (default)
 - node: 20.12.0
@thewh1teagle
thewh1teagle / README.md
Last active May 12, 2024 22:16
Git commit signing on Windows

Commit signing on Windows

  1. Open notepad.exe
  2. Open github.com/settings/emails
  3. Copy your Github email to notepad (ends with @users.noreply.github.com)
  4. Open cmd.exe
  5. Create new ssh key
ssh-keygen -t ed25519 -C "{email}"
@thewh1teagle
thewh1teagle / README.md
Created May 9, 2024 22:09
Copy folder exclude subdirectory

Copy folder exclude subdirectory

rsync -av --exclude target/ make1/ make2
@thewh1teagle
thewh1teagle / main.rs
Last active May 8, 2024 14:41
catch panics in rust
fn main() {
// Set up a panic hook to print the backtrace
std::panic::set_hook(Box::new(|info| {
let mut message = String::new();
message.push_str(&format!("thread '{}' ", std::thread::current().name().unwrap_or("unknown")));
message.push_str(&format!("{}", info));
if let Ok(var) = std::env::var("RUST_BACKTRACE") {
if var == "1" {
let backtrace = std::backtrace::Backtrace::capture();
message.push_str(&format!("{}", backtrace));

Accessibility control permission checking on macOS

image

@thewh1teagle
thewh1teagle / index.js
Created May 3, 2024 17:43
Concurrent NodeJS downloader
import fs from 'fs'
async function getMeta(url) {
let resp = await fetch(url, { method: 'HEAD' });
const size = parseInt(resp.headers.get('Content-Length'));
const contentDisposition = resp.headers.get('Content-Disposition')
const filename = contentDisposition.match(/; filename=(.+)/)[1] ?? 'Unnamed'
return {size, filename};
}
@thewh1teagle
thewh1teagle / BCP47-locales.md
Created April 29, 2024 23:09 — forked from typpo/BCP47-locales.md
BCP 47 language tags
Language Tag Language Region Description
ar-SA Arabic Saudi Arabia Arabic (Saudi Arabia)
bn-BD Bangla Bangladesh Bangla (Bangladesh)
bn-IN Bangla India Bangla (India)
cs-CZ Czech Czech Republic Czech (Czech Republic)
da-DK Danish Denmark Danish (Denmark)
de-AT German Austria Austrian German
de-CH German Switzerland "Swiss" German
de-DE German Germany
warning: patch for the non root package will be ignored, specify patch at the workspace root:
package:   C:\Users\User\Documents\code\vibe\desktop\src-tauri\Cargo.toml
workspace: C:\Users\User\Documents\code\vibe\Cargo.toml
        Info Watching C:\Users\User\Documents\code\vibe\core for changes...
        Info Watching C:\Users\User\Documents\code\vibe\desktop\src-tauri for changes...
        Info Watching C:\Users\User\Documents\code\vibe\cli for changes...
   Compiling proc-macro2 v1.0.81
   Compiling unicode-ident v1.0.12
   Compiling cfg-if v1.0.0
@thewh1teagle
thewh1teagle / main.rs
Created April 22, 2024 00:13
temp path in rust
use eyre::{bail, Context, Result};
use privilege::user::privileged;
use rand::distributions::Alphanumeric;
use rand::{thread_rng, Rng};
use std::path::PathBuf;
pub fn temp_path(prefix: &str, suffix: &str, rand_len: usize) -> PathBuf {
let random_string: String = thread_rng()
.sample_iter(&Alphanumeric)
.take(rand_len)
@thewh1teagle
thewh1teagle / main.rs
Created April 14, 2024 19:31
Capture speakers output on macos with rust
use std::sync::mpsc::{sync_channel, SyncSender};
use screencapturekit::sc_stream::SCStream;
use screencapturekit::{
cm_sample_buffer::CMSampleBuffer,
sc_content_filter::InitParams::Display,
sc_content_filter::SCContentFilter,
sc_error_handler::StreamErrorHandler,
sc_output_handler::{SCStreamOutputType, StreamOutput},