Skip to content

Instantly share code, notes, and snippets.

@cute
cute / is_connected_to_vpn.swift
Created December 30, 2023 11:16 — forked from azwan082/is_connected_to_vpn.swift
Check if iOS app is connected to VPN
func isConnectedToVpn() -> Bool {
let host = "www.example.com"
guard let reachability = SCNetworkReachabilityCreateWithName(nil, host) else {
return false
}
var flags = SCNetworkReachabilityFlags()
if SCNetworkReachabilityGetFlags(reachability, &flags) == false {
return false
}
let isOnline = flags.contains(.reachable) && !flags.contains(.connectionRequired)
@cute
cute / .gitignore
Created October 16, 2023 09:33 — forked from jirihnidek/.gitignore
Example of (Linux) client-server aplication using ECN bit in UDP packets.
.cproject
.project
build
@cute
cute / ios-default-fontsize-table.swift
Created October 15, 2023 11:52 — forked from christianklotz/ios-default-fontsize-table.swift
List of default font sizes for dynamic type
let defaultFontSizeTable = [
UIFontTextStyleHeadline: [
UIContentSizeCategoryAccessibilityExtraExtraExtraLarge: 26,
UIContentSizeCategoryAccessibilityExtraExtraLarge: 25,
UIContentSizeCategoryAccessibilityExtraLarge: 24,
UIContentSizeCategoryAccessibilityLarge: 24,
UIContentSizeCategoryAccessibilityMedium: 23,
UIContentSizeCategoryExtraExtraExtraLarge: 23,
UIContentSizeCategoryExtraExtraLarge: 22,
UIContentSizeCategoryExtraLarge: 21,
@cute
cute / openssl-build.sh
Created September 1, 2023 06:45 — forked from felix-schwarz/openssl-build.sh
Updated script that builds OpenSSL for OS X, iOS and tvOS. Bitcode enabled for iOS, tvOS. Updated to build for tvOS, use the latest SDKs, skip installing man pages (to save time), download the OpenSSL source over HTTPS, patch OpenSSL for tvOS to not use fork(). Currently requires Xcode7.1b or later (for the tvOS SDK).
#!/bin/bash
# This script downloads and builds the iOS, tvOS and Mac openSSL libraries with Bitcode enabled
# Credits:
# https://github.com/st3fan/ios-openssl
# https://github.com/x2on/OpenSSL-for-iPhone/blob/master/build-libssl.sh
# https://gist.github.com/foozmeat/5154962
# Peter Steinberger, PSPDFKit GmbH, @steipete.
# Felix Schwarz, IOSPIRIT GmbH, @felix_schwarz.
@cute
cute / endian.h
Created December 13, 2022 05:03 — forked from yinyin/endian.h
BSD/Linux-like <endian.h> for MacOS X
#ifndef __FINK_ENDIANDEV_PKG_ENDIAN_H__
#define __FINK_ENDIANDEV_PKG_ENDIAN_H__ 1
/** compatibility header for endian.h
* This is a simple compatibility shim to convert
* BSD/Linux endian macros to the Mac OS X equivalents.
* It is public domain.
* */
#ifndef __APPLE__
@cute
cute / StickyHeadersCollectionViewFlowLayout.m
Created September 20, 2022 10:06 — forked from megakode/StickyHeadersCollectionViewFlowLayout.m
A subclass of UICollectionViewFlowLayout which has UITableView style sticky headers.
// StickyHeadersCollectionViewFlowLayout
//
// A subclass of UICollectionViewFlowLayout which has UITableView style sticky headers.
//
// This code is based on Evadne Wu's code^1, with the following changes:
//
// * Fixes a crash for sections with zero items
// * Adds support for UIScrollView's contentInset
// * Adds support for UICollectionViewFlowLayout's sectionInset
//
@cute
cute / nf_check.js
Created August 24, 2022 10:13 — forked from Hyseen/nf_check.js
Netflix 解锁检测模块
/**
*
* [Panel]
* nf_check = script-name=nf_check, title="Netflix 解锁检测", content="请刷新", update-interval=1
*
* [Script]
* nf_check = type=generic, script-path=https://gist.githubusercontent.com/Hyseen/b06e911a41036ebc36acf04ddebe7b9a/raw/nf_check.js?version=1633074636264, argument=title=Netflix 解锁检测
*
* 支持使用脚本使用 argument 参数自定义配置,如:argument=key1=URLEncode(value1)&key2=URLEncode(value2),具体参数如下所示,
* title: 面板标题
@cute
cute / openssl_configure.md
Created February 21, 2022 07:54
OpenSSL configure options

Deprecated - Use LibreSSL Portable instead

OpenSSL Configure Options (1.0.1e)

Standard party line

Usage: Configure [no-<cipher> ...] [enable-<cipher> ...] [experimental-<cipher> ...]
                 [-Dxxx] [-lxxx] [-Lxxx] [-fxxx] [-Kxxx] [no-hw-xxx|no-hw]
                 [[no-]threads] [[no-]shared] [[no-]zlib|zlib-dynamic] [no-asm]

[no-dso] [no-krb5] [sctp] [386] [--prefix=DIR]

@cute
cute / stuns
Created April 21, 2021 01:39 — forked from zziuni/stuns
STUN server list
# source : http://code.google.com/p/natvpn/source/browse/trunk/stun_server_list
# A list of available STUN server.
stun.l.google.com:19302
stun1.l.google.com:19302
stun2.l.google.com:19302
stun3.l.google.com:19302
stun4.l.google.com:19302
stun01.sipphone.com
stun.ekiga.net
# 除了注释建议浏览官方手册(https://manual.nssurge.com/)、帮助中心(https://nssurge.zendesk.com/)以及技术社区(https://community.nssurge.com)
[General]
bypass-system = true
loglevel = notify
replica = false
# TLS 引擎
tls-provider = default
# IPv6 支持(关闭)
ipv6 = false