Skip to content

Instantly share code, notes, and snippets.

@preinpost
preinpost / home_screen.dart
Created March 3, 2023 15:49
headers override
// 에러의 원인
// 따로 User-Agent 값을 추가하지 않으면 기본값으로 `Dart/<version> (dart:io)` 가 들어갑니다.
// (https://api.flutter.dev/flutter/dart-io/HttpClient/userAgent.html)
// 이 값을 지우고 브라우저에서 사용하는 값으로 바꿔줍니다.
// (브라우저 값이 아니면 네이버에서 차단하는걸로 보입니다)
// 방법 1. (local? override)
// [home_screen.dart]
import hmacSHA256 from "crypto-js/hmac-sha256"
import Base64url from "crypto-js/enc-base64url"
import { Buffer } from "buffer"
export default function generateMockToken() {
const header = {
typ: "JWT",
alg: "HS256"
}
@preinpost
preinpost / main.rs
Last active May 15, 2023 13:49
mac app entry
use cacao::appkit::{App, AppDelegate};
use cacao::appkit::window::Window;
use cacao::color::Color;
#[derive(Default)]
struct BasicApp {
}
@preinpost
preinpost / main.rs
Created May 5, 2024 12:47
Rust Atomics and Locks - ch4
use std::cell::UnsafeCell;
use std::fmt::{Debug, Formatter, Pointer};
use std::ops::{Deref, DerefMut};
use std::sync::atomic::AtomicBool;
use std::sync::atomic::Ordering::{Acquire, Release};
use std::thread;
pub struct SpinLock<T> {
locked: AtomicBool,
value: UnsafeCell<T>,