Skip to content

Instantly share code, notes, and snippets.

View ringsaturn's full-sized avatar
🌴
On vacation

ringsaturn ringsaturn

🌴
On vacation
View GitHub Profile
@hanxiao
hanxiao / testRegex.js
Last active September 20, 2024 05:25
Regex for chunking by using all semantic cues
// Updated: Aug. 20, 2024
// Run: node testRegex.js whatever.txt
// Live demo: https://jina.ai/tokenizer
// LICENSE: Apache-2.0 (https://www.apache.org/licenses/LICENSE-2.0)
// COPYRIGHT: Jina AI
const fs = require('fs');
const util = require('util');
// Define variables for magic numbers
const MAX_HEADING_LENGTH = 7;
@unixzii
unixzii / ForceEnablingXcodeLLM.md
Last active September 18, 2024 08:05
A guide to force enabling Xcode LLM feature on China-SKU Macs.

Introduction

Apple restricted the access to Xcode LLM (Predictive code completion) feature on China models of Mac. This guide provides a way to bypass that restriction. It's verified on macOS 15.0 Beta (24A5264n), but there is no guarentee that it will always work on later macOS versions.

Prerequisites

  • Xcode is installed and run at least once.
  • SIP debugging restrictions are disabled (via csrutil enable --without debug command in recovery mode).

Disclaimer

@keltecc
keltecc / !README.md
Last active June 21, 2024 10:26
[pymongo] out-of-bounds read PoC (CVE-2024-5629)
@greg-randall
greg-randall / lat-lon-mon.py
Created February 25, 2024 01:00
Human Readable Moon Phase from Latitude & Longitude
from datetime import datetime
from skyfield.api import load
from skyfield.framelib import ecliptic_frame
from tzfpy import get_tz
import pytz
def human_moon(lat, lon):
ts = load.timescale()
# Get the current time in the specified timezone
@phuslu
phuslu / cachingmap.go
Last active May 9, 2024 03:50
双缓冲实现无锁map,读取性能和GC友好度最好,一致性较差,写入延迟一般建议设置为分钟级。 https://twitter.com/phuslu/status/1745276311235395708
type CachingMap[K comparable, V any] struct {
// double buffering mechanism
index int64
maps [2]map[K]V
// write queue
queue chan struct {
key K
value V
}
@cloudwu
cloudwu / sortnumber.c
Created August 1, 2023 05:38
sort telephone number
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <stdio.h>
#define N (100000063/64)
struct bitset {
uint64_t bits[N];
@darrenwiens
darrenwiens / index.html
Created November 30, 2022 02:57
Mapbox single tile map client and API
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Single tile</title>
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
<link href="https://api.mapbox.com/mapbox-gl-js/v2.10.0/mapbox-gl.css" rel="stylesheet">
<script src="https://api.mapbox.com/mapbox-gl-js/v2.10.0/mapbox-gl.js"></script>
<script src="https://unpkg.com/@turf/turf@6/turf.min.js"></script>
@Zheaoli
Zheaoli / The new version v1.24.0 kubectl cli uses an invalid workaround on aws eks.md
Last active April 28, 2024 21:53
新版 v1.24.0 kubectl cli 在 aws eks 上使用失效的解决方法.md

Please update your awscli to 2.6.3

In v1.24.0, kubectl will report the following error when relying on the kubeconfig generated by aws-cli

> error: exec plugin: invalid apiVersion "client.authentication.k8s.io/v1alpha1"

The reason is that Kubernetes deprecated client.authentication.k8s.io/v1alpha1" from the exec plugin in PR108616

And the aws-cli update PR6476 has not been merged. There are two solutions

@huytd
huytd / wordle.md
Last active August 27, 2024 20:38
Wordle in less than 50 lines of Bash

image

How to use:

./wordle.sh

Or try the unlimit mode:

@ColdGrub1384
ColdGrub1384 / Battery.py
Created September 22, 2020 15:32
A battery widget for the Home Screen monitoring in background.
# Created with Pyto
import widgets as wd
import sf_symbols as sf
import sys
from datetime import time
from UIKit import UIDevice
from background import BackgroundTask
from threading import Thread