Skip to content

Instantly share code, notes, and snippets.

View thewh1teagle's full-sized avatar
💭
coding

thewh1teagle

💭
coding
  • localhost
  • The martian
View GitHub Profile
@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},
@thewh1teagle
thewh1teagle / README.md
Created March 31, 2024 19:11
Play with dmg file on macos

Sign with ad-hoc identity

codesign -f -s - ./name.app

Check signature

codesign -dv ./name.app

Inspect dmg and create new one

  1. Click on the dmg
from datetime import timedelta, datetime
import sqlite3
# Create database with table
path = 'data.db'
conn = sqlite3.connect(path)
cur = conn.cursor()
cur.execute('CREATE TABLE IF NOT EXISTS data (id INTEGER PRIMARY KEY, date TEXT)')
# Create mock data from latest 30 days
import serial
import threading
import time
import sys
class STM:
def __init__(self, port: str, baudrate: str) -> None:
self.ser: serial.Serial = None
self.port = port
self.baudrate = baudrate
[
{
"date": "2024-02-29 20:17:19",
"speed": 82.30914189627686
}
]
use std::collections::HashMap;
use tao::{
event::{ElementState, Event, KeyEvent, WindowEvent},
event_loop::{ControlFlow, EventLoop},
window::{Window, WindowBuilder},
};
fn main() {
env_logger::init();
let event_loop = EventLoop::new();
async fn eval_with_event(webview: Webview, event_name: &str, script: &str, timeout: Duration) -> anyhow::Result<Value> {
let (sender, receiver): (Sender<String>, Receiver<String>) = channel();
let id = webview.listen(event_name, move |event| {
let value = event.payload().to_string();
let result = sender.send(value);
if let Err(err) = result {
log::error!("failed to get result from callback {}", err);
}
});
let result = webview.eval(&script);