Skip to content

Instantly share code, notes, and snippets.

View kevinzhow's full-sized avatar
🏠
正在搬砖

Kevin kevinzhow

🏠
正在搬砖
View GitHub Profile
@kevinzhow
kevinzhow / Alamofire+Protobuf.swift
Created November 28, 2022 18:23
Makes the alamofire can encode protobuf easily
import Foundation
import Alamofire
open class ProtobufParameterEncoder: ParameterEncoder {
/// Returns an encoder with default parameters.
public static var `default`: ProtobufParameterEncoder { ProtobufParameterEncoder() }
public init() {}
@kevinzhow
kevinzhow / validator.swift
Created April 5, 2022 08:04
Example of How to create Validator in Vapor4
/// Define
extension Validator where T == String {
/// Validates whether a `String` is a valid email address.
public static var zipCode: Validator<T> {
.init {
guard
let range = $0.range(of: zipCodeRegex, options: [.regularExpression]),
range.lowerBound == $0.startIndex && range.upperBound == $0.endIndex
else {
return ValidatorResults.ZipCode(isValidZipCode: false)
@kevinzhow
kevinzhow / docker-compose.yml
Last active March 28, 2022 07:38
albatross
# albatross
version: '3.7'
services:
app:
image: ghcr.io/kevinzhow/albatross:latest
restart: unless-stopped
environment:
LOG_LEVEL: ${LOG_LEVEL:-debug}
ADMIN_USERNAME: albatross
extension AppThemeModeExt on AppThemeMode {
AppThemeData get themeData {
switch (this) {
case AppThemeMode.light:
return AppThemeData(
primaryColor: Color(0xFF28AA4B),
backgroundColor: Colors.white,
tileColor: Colors.white,
tableColor: Color(0xFFF3F3F3),
titleColor: Colors.black,
@kevinzhow
kevinzhow / GzipMiddleware.swift
Last active September 8, 2021 20:05
Vapor 4 Gzip middleware
//
// GzipMiddleware.swift
// GzipMiddleware
//
// Created by 周楷雯 on 2021/9/8.
//
// MARK: use https://docs.vapor.codes/4.0/server/#response-compression instead of this script
// MARK: Use this at end of app.middleware
server=/.apple.com/114.114.114.114#53
server=/adcdownload.apple.com/114.114.114.114
server=/appldnld.apple.com/114.114.114.114
server=/cdn-cn1.apple-mapkit.com/114.114.114.114
server=/cdn-cn2.apple-mapkit.com/114.114.114.114
server=/cdn-cn3.apple-mapkit.com/114.114.114.114
server=/cdn-cn4.apple-mapkit.com/114.114.114.114
server=/cdn.apple-mapkit.com/114.114.114.114
server=/cdn1.apple-mapkit.com/114.114.114.114
server=/cdn2.apple-mapkit.com/114.114.114.114
@kevinzhow
kevinzhow / NMPD.md
Last active November 30, 2022 16:36
在 macOS 10.12 配置 Nginx+MySQL+PHP+Discuz
Stack trace[Hide framework code]
org.apache.catalina.connector.ClientAbortException: java.io.IOException: Broken pipe
….apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:393)
org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:426)
org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:339)
org.apache.catalina.connector.OutputBuffer.writeBytes(OutputBuffer.java:418)
org.apache.catalina.connector.OutputBuffer.write(OutputBuffer.java:406)
org.apache.catalina.connector.CoyoteOutputStream.write(CoyoteOutputStream.java:97)
…erxml.jackson.core.json.UTF8JsonGenerator._flushBuffer(UTF8JsonGenerator.java:2003)
This file has been truncated, but you can view the full file.
server=/.0-6.com/202.106.196.115
server=/.0-gold.net/202.106.196.115
server=/.00.net/202.106.196.115
server=/.0000738.com/202.106.196.115
server=/.0001688.com/202.106.196.115
server=/.000219.com/202.106.196.115
server=/.0007.net/202.106.196.115
server=/.000dn.com/202.106.196.115
server=/.000e.com/202.106.196.115
server=/.000w.net/202.106.196.115
#!/bin/bash
export MACOSX_DEPLOYMENT_TARGET="10.9"
: << '#__REM__'
指定さたライブラリをiOS用にフルオートで作成します。ダウンロード、複数のアーキテクチャのビルドも自動的に行います。デフォルトではi386、x86_64、armv7、armv7s、arm64のアーキテクチャを作成します。
Create a full-auto to iOS for the library specified. I do also builds the architecture download, more than one. Create architecture i386, x86_64, armv7, armv7s, arm64 by default.
#__REM__