Skip to content

Instantly share code, notes, and snippets.

@GeeLaw
GeeLaw / pokemon.cpp
Last active April 9, 2024 12:12
通过攻击抗性决定敌方宝可梦的属性组合 / determining type combo of an unknown enemy pokémon from type-based prompts against attacks
/*
Copyright 2024 by Ji Luo
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
#!/usr/bin/env bash
cd $(dirname "$0")
read -sp "Password: " pwd
echo
rm -rf ~/Library/Application Support/com.nssurge.surge-*
echo "${pwd}" | sudo -S date 010110002018
nohup ./Surge\ 3.app/Contents/MacOS/Surge\ 3 &
sleep 20
@kemchenj
kemchenj / CodeTextField.swift
Last active December 11, 2023 07:19
CodeTextField
import UIKit
class CodeTextField: UITextField, UITextFieldDelegate {
let codeLength: Int
var characterSize: CGSize
var characterSpacing: CGFloat
let textPreprocess: (String) -> String
let validCharacterSet: CharacterSet
@onevcat
onevcat / Delegate.swift
Last active December 23, 2022 07:21
An auto-weak delegate for handle modern delegate pattern.
import Foundation
/// A class that keeps a weakly reference for `self` when implementing `onXXX` behaviors.
/// Instead of remembering to keep `self` as weak in a stored closure:
///
/// ```swift
/// // MyClass.swift
/// var onDone: (() -> Void)?
/// func done() {
/// onDone?()
@zwaldowski
zwaldowski / Activity.swift
Last active June 10, 2024 15:22
os_activity_t for Swift 3
//
// Activity.swift
//
// Created by Zachary Waldowski on 8/21/16.
// Copyright © 2016 Zachary Waldowski. Licensed under MIT.
//
import os.activity
private final class LegacyActivityContext {