Skip to content

Instantly share code, notes, and snippets.

@gitawego
gitawego / setup_ubuntu.sh
Last active June 3, 2026 17:29
setup_ubuntu.sh
#!/usr/bin/env bash
# Exit immediately if a command exits with a non-zero status
set -e
echo "=== 1. Updating Termux repositories and installing proot-distro ==="
pkg update -y
pkg install proot-distro -y
echo "=== 2. Installing Ubuntu via proot-distro ==="
#!/usr/bin/env bash
# Claude Code statusline: cache-hit tracking merged with
# https://github.com/danielmackay/claude-code-statusline
#
# Line 1: 🤖 model | 🧠 ctx N% | 💪 effort | ⚡ Cache N% ΣN% MM:SS | 💰 $X.XX
# Cache: last-response hit rate, Σ session-cumulative rate, TTL countdown.
# ↺ (bold red) marks a cache bust — large rebuild after prefix invalidation.
# Line 2: 📁 dir | 🌳 worktree | 🌿 branch +staged ~modified | ⏱️ 5h ███░░░ N% ~dur | 7d ███░░░ N% ~dur
#
# State dir: ~/.claude/statusline-state/<session_hash>.json (cache TTL tracking)
@gitawego
gitawego / SecuredStorage.ts
Last active January 23, 2025 08:20
Secure storage
export interface SecureStorageOptions {
useLocalStorage?: boolean;
disableAutoGenKey?: boolean;
}
export class SecureStorage {
private readonly algorithm = 'AES-GCM';
private readonly keyLength = 256;
@gitawego
gitawego / webworker.ts
Last active January 23, 2025 08:19
webworker
/**
* example of worker (ex: worker.ts)
*
* ```ts
* self.addEventListener('message', (event) => {
const { eventName, data, messageId } = event.data;
switch (eventName) {
case 'double':
const result = data * 2;
@gitawego
gitawego / frenchPostalCode.ts
Last active November 6, 2024 16:58
control french postal code
export function validateFrenchPostalCode(
input: string,
partialControl = false
): boolean {
// Check length constraints
if (input.length > 5 || (!partialControl && input.length !== 5)) {
return false;
}
const finalInput = input.toUpperCase();
js复制代码// 美化打印实现方法
const prettyLog = () => {
const isProduction = import.meta.env.MODE === 'production';
const isEmpty = (value: any) => {
return value == null || value === undefined || value === '';
};
const prettyPrint = (title: string, text: string, color: string) => {
if (isProduction) return;
console.log(
@gitawego
gitawego / moonlight_sunshine_gamestream_guide.md
Last active August 25, 2023 08:52 — forked from JasSuri/moonlight_sunshine_gamestream_guide.md
Moonlight and Sunshine gamestream guide for Windows 11

This guide was last updated: 20th December 2022, and the most optimum settings may differ as Sunshine and Moonlight are updated.

Overview

This guide is intended to help those migrating from streaming their games with Nvidia GameStream, to Sunshine. It will help you setup the Moonlight client and Sunshine gamesteam host to stream your PC games to your other devices. The aim is to optimise the settings to get similar streaming performance as Nvidia GameStream.

Prerequisites

  1. Download and install Moonlight client on your chosen device
  2. Download and install the nightly build of Sunshine gamestream host on the PC which you want to stream games from.
@gitawego
gitawego / workshop.md
Last active April 30, 2023 22:05
conan-exiles

workshop

recommanded mods

[{
    "id":"880454836",
    "name":"Pippi - User & Server Management"
},{
 "id":"2874346399",
{
appenders: {
access: {
type: 'dateFile',
filename: 'log/access.log',
pattern: '-yyyy-MM-dd',
category: 'http',
},
app: {
type: 'file',
@gitawego
gitawego / readme.md
Last active January 5, 2022 22:53
chrome os

Chrome OS Tips

Change your Chromebook’s performance setting

in setting chrome://flags/#scheduler-configuration, choose Enables Hyper-Threading on relevant CPUs. and restart

mount partitions (copied from MuntashirAkon)

  • Open crosh (CTRL+ALT+T, then type shell in terminal)
  • find partition using lsblk -e7