Skip to content

Instantly share code, notes, and snippets.

@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
@gitawego
gitawego / minetest.md
Last active November 13, 2021 22:59
raspberry pi

MineTest

install in raspberry pi

sudo apt install flatpak
sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
flatpak install flathub net.minetest.Minetest
@gitawego
gitawego / git-tags-sort.groovy
Last active November 3, 2019 14:56
sort tags in groovy
// get tags from git first
// git ls-remote --tags --refs https://github.com/angular/angular.git
// def arr = "git ls-remote --tags --refs https://github.com/angular/angular.git".execute()
// arr.waitFor()
// def result = arr.text.tokenize('\n')
def result = new String[3]
result[0] = "d6602ec5194c87b0fc87103ca4d67251c76f233a refs/tags/v1.99"
result[1] = "f25a265a342aed6041ab0cc484224d9ca54b6f41 refs/tags/v0.03.1"
result[2] = "7ceca275d047c90c0c7d5afb13ab97efdf51bd6e refs/tags/v0.03.10"
@gitawego
gitawego / proxify.sh
Created October 15, 2019 21:29
proxify alias behind enterprise
#!/bin/bash
set -e
PROXY_URL=myproxy.socgen.com
PROXY_USERNAME=my_user_name
function proxy_fnc(){
read -s -p "Enter Password: " PROXY_PASSWORD
echo
local prefix="$PROXY_USERNAME:$PROXY_PASSWORD"
@gitawego
gitawego / swarm.js
Created July 1, 2019 22:21
swarm discovery
var swarm = require('discovery-swarm');
const crypto = require('crypto');
const net = require('net');
const topic = crypto.createHash('sha256')
.update('my key')
.digest();
console.log('args',process.argv);
const port = process.argv[2] || 10001;
var sw = swarm({
dns:{