Skip to content

Instantly share code, notes, and snippets.

View Nyaasu66's full-sized avatar
🕘
Never too late

Nyaasu Nyaasu66

🕘
Never too late
View GitHub Profile
@Nyaasu66
Nyaasu66 / ana_ext.bash
Created July 19, 2024 08:00
统计当前目录及子目录下的文件扩展名数量
find . -type f | sed -e 's/.*\.//' | sed -e 's/.*\///' | sort | uniq -c | sort -rn
@Nyaasu66
Nyaasu66 / index.js
Last active July 18, 2024 07:09
nodejs + websocket 测试服务端(需要 npm i ws)
const WebSocket = require("ws");
const os = require("os");
const readline = require("readline");
// 获取局域网地址
function getLocalIPAddress() {
const interfaces = os.networkInterfaces();
for (let iface of Object.values(interfaces)) {
for (let alias of iface) {
if (alias.family === "IPv4" && !alias.internal) {
@Nyaasu66
Nyaasu66 / App.tsx
Last active July 18, 2024 07:24
RN + websocket 客户端最小实现
import React, {useEffect, useRef} from 'react';
import {SafeAreaView, Text, View} from 'react-native';
import {Colors} from 'react-native/Libraries/NewAppScreen';
const url = 'ws://192.168.40.241:8080';
function App(): React.JSX.Element {
const ws = useRef<WebSocket>();
const [wsMessage, setWsMessage] = React.useState('');
@Nyaasu66
Nyaasu66 / script.js
Last active February 19, 2024 02:29
Chat Mfweb Beautify
// ==UserScript==
// @name Chat Mfweb Beautify
// @namespace https://gist.github.com/Nyaasu66/9cfffb9431b4e5440f4b92a0ae9ef4bd
// @version 0.1.3
// @description awa
// @author Nyaasu66
// @match https://chat.mfweb.top/
// @icon https://www.google.com/s2/favicons?sz=64&domain=mfweb.top
// @grant none
// ==/UserScript==
@Nyaasu66
Nyaasu66 / battery.html
Created April 23, 2023 08:34
显示设备电量/充电状态,单 html 文件
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>My battery level</title>
</head>
<body>
<div id="battery">
<div id="level">
#!/bin/bash
set -e
file=$(defaults read /Applications/Navicat\ Premium.app/Contents/Info.plist)
regex="CFBundleShortVersionString = \"([^\.]+)"
[[ $file =~ $regex ]]
version=${BASH_REMATCH[1]}