Skip to content

Instantly share code, notes, and snippets.

View wilinz's full-sized avatar

wilinz wilinz

  • Guilin University of Electronic Technology School of Artificial Intelligence
  • China Guilin
View GitHub Profile
wilinz / MoshiExt.kt
Created November 27, 2023 19:10
View MoshiExt.kt
import com.squareup.moshi.JsonAdapter
import com.squareup.moshi.JsonReader
import com.squareup.moshi.JsonWriter
import com.squareup.moshi.Moshi
import okio.BufferedSink
import okio.BufferedSource
inline fun <reified T> Moshi.adapter(): JsonAdapter<T> = adapter(
inline fun <reified T> Moshi.toJson(v: T): String = adapter<T>().toJson(v)
wilinz / pointer.go
Last active October 25, 2023 16:16
go pointer util
View pointer.go
package ptr
func ptr[T any](v T) *T {
return &v
func unptr[T any](ptr *T) T {
return *ptr
wilinz / delete_all_wordArt.vba
Last active September 16, 2023 09:03
delete all wordArt
View delete_all_wordArt.vba
Sub DeleteArtisticText()
Dim oShape As Shape
Dim toDelete As New Collection
Dim targetTexts() As Variant
' Specify the texts you want to delete
targetTexts = Array("Text1", "Text2", "Text3") ' Add your specific texts here
' First, find all shapes to delete and add them to the collection
For Each oShape In ActiveDocument.Shapes
wilinz / selection_transformer.dart
Last active August 19, 2023 06:40 — forked from schultek/selection_transformer.dart
A widget that transforms the text selection when copied.
View selection_transformer.dart
import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart';
typedef SelectionTransform = String Function(Iterable<String>);
/// A widget that transforms the text selection when copied.
/// This uses the [SelectionContainer] with a custom [SelectionContainerDelegate] to override the
/// [getSelectedContent] method with a custom implementation.
wilinz /
Last active January 25, 2024 02:30
wilinz / MyLifecycleOwner.kt
Created February 16, 2023 12:24 — forked from handstandsam/MyLifecycleOwner.kt
Jetpack Compose OverlayService. You have to have all the correct permissions granted and in your manifest, but if you do, this this will show a green box with "Hello" in it!
View MyLifecycleOwner.kt
import android.os.Bundle
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleRegistry
import androidx.savedstate.SavedStateRegistry
import androidx.savedstate.SavedStateRegistryController
import androidx.savedstate.SavedStateRegistryOwner
internal class MyLifecycleOwner : SavedStateRegistryOwner {
private var mLifecycleRegistry: LifecycleRegistry = LifecycleRegistry(this)
private var mSavedStateRegistryController: SavedStateRegistryController = SavedStateRegistryController.create(this)
wilinz /
Created July 26, 2022 20:09
Google translate Language list
wilinz / googleChromeTranslateApi.js
Last active July 2, 2023 07:04
View googleChromeTranslateApi.js
const googleTranslateTKK = "448487.932609646";
function shiftLeftOrRightThenSumOrXor(num, optString) {
for (let i = 0; i < optString.length - 2; i += 3) {
let acc = optString.charAt(i + 2);
if ('a' <= acc) {
acc = acc.charCodeAt(0) - 87;
} else {
acc = Number(acc);
View git 设置和取消代理
git config --global https.proxy
git config --global https.proxy
git config --global --unset http.proxy
git config --global --unset https.proxy
npm config delete proxy