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 / yad2.js
Created September 22, 2024 12:00
Insert links in yad2
function insertLinks() {
const products = document.querySelectorAll('div[data-product-endpoint]');
for (const product of products) {
var productUrl = product.getAttribute('data-product-endpoint');
var link = document.createElement('a');
link.href = productUrl;
link.innerHTML = product.outerHTML;
link.target = '_blank';
product.parentNode.insertBefore(link, product);
product.remove();
@thewh1teagle
thewh1teagle / wget.ts
Created September 21, 2024 13:07
Wget in nodejs
import {randomBytes} from "node:crypto";
import fs from 'fs'
function randomString(length = 10) {
return randomBytes(length).toString('hex');
}
interface wgetOpts {
out_path?: string | null
import { remember } from "@epic-web/remember";
import mysql from "mysql2/promise";
import "./config";
import { Player } from "./types";
import { nomrmalizeNumber } from "./utils";
var conn: mysql.Connection;
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|  Action                                                                                                                                                               |  Mean duration (s)    |  Num calls            |  Total time (s)       |  Percentage %         |
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|  Total                                                                                                                                                                |  -                    |  14775             
[package]
name = "present"
version = "0.0.0"
description = "A Tauri App"
authors = ["you"]
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[build-dependencies]
PS D:\kebo\clients\present> bunx tauri dev -- -vv
    Running BeforeDevCommand (`bun run dev`)
$ vite

  VITE v5.3.1  ready in 328 ms

  ➜  Local:   http://localhost:1420/
  ➜  Network: use --host to expose
    Info Watching D:\kebo\clients\present\src-tauri for changes...
desktop git:(main) ✗ bunx tauri dev
    Running BeforeDevCommand (`bun run dev`)
$ vite

  VITE v5.4.2  ready in 220 ms

  ➜  Local:   http://localhost:1420/
  ➜  Network: use --host to expose
@thewh1teagle
thewh1teagle / main.cpp
Created August 27, 2024 18:25
C++ gui mode attach to console and redirect standard output
#include <iostream>
#include <cstdio>
#include <windows.h>
int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
// Attach to the parent console
if (AttachConsole(ATTACH_PARENT_PROCESS)) {
// Redirect stdout and stderr to the console
freopen("CONOUT$", "w", stdout);
freopen("CONOUT$", "w", stderr);
fn write_input_data<T, U>(input: &[T], writer: &WavWriterHandle, resampler: &mut SincFixedIn<f64>)
where
T: Sample,
U: Sample + hound::Sample + FromSample<T>,
{
// Convert input to f64
let samples: Vec<f64> = input
.iter()
.map(|&s| U::from_sample(s).to_float_sample().to_sample())
.collect();