Skip to content

Instantly share code, notes, and snippets.

View wen-long's full-sized avatar
☘️
wish to be lucky

wen-long

☘️
wish to be lucky
View GitHub Profile
@wen-long
wen-long / cmds.txt
Last active August 29, 2015 14:21 — forked from wong2/cmds.txt
//wearversion
//wearlog
//wearvoiceinputenable
//wearvoiceinputdisable
//weargoogleapi
//assert
//pushassert
//uplog
//upcrash
//switchnotificationstatus
@wen-long
wen-long / serial.m
Last active September 3, 2015 16:30 — forked from markd2/serial.m
Playing with NSPropertyListSerialization
#import <Foundation/Foundation.h>
// clang -g -Wall -fobjc-arc -framework Foundation -o serial serial.m
static id makePlistObjects (void) {
NSMutableDictionary *top = [NSMutableDictionary dictionary];
[top setObject: @"Hi I'm a string" forKey: @"string"];
[top setObject: [NSNumber numberWithInt: 23] forKey: @"number"];
@wen-long
wen-long / iOSAutoLayoutDebug
Last active September 7, 2015 10:25 — forked from xNekOIx/iOSAutoLayoutDebug
iOS AutoLayout debug
po [[UIWindow keyWindow] _autolayoutTrace] // prints layouts ambiguity
po [view constraintsAffectingLayoutForAxis:0] // horizontal
po [view constraintsAffectingLayoutForAxis:1] // vertical
[view hasAmbiguousLayout] // BOOL
[view exerciseAmbiguityInLayout] // visualizing ambiguity
viewController.extendedLayoutIncludesOpaqueBars = NO;
viewController.automaticallyAdjustsScrollViewInsets = NO;
viewController.edgesForExtendedLayout = UIRectEdgeNone;
@wen-long
wen-long / update.php
Created January 14, 2016 15:07 — forked from lifesign/update.php
纯真数据库自动更新
<?php
/*
纯真数据库自动更新原理实现
示例代码使用php实现,从copywrite.rar中读取解密需要的一个key,然后解密qqwry.rar头0x200字节数据,随后使用zlib解压数据即可得到qqwry.dat文件
通过此代码的实现,你应该可以自行实现一个纯真数据库更新工具。copywrite.rar中还有一些更多的数据,没有一一列出,比如版本号、qqwry.rar文件大小。
collect from https://github.com/shuax/QQWryUpdate/blob/master/update.php
*/
$copywrite = file_get_contents("http://update.cz88.net/ip/copywrite.rar");
$qqwry = file_get_contents("http://update.cz88.net/ip/qqwry.rar");
@wen-long
wen-long / sniproxy.md
Created January 8, 2018 16:31 — forked from pjamar/sniproxy.md
SNI Proxy Tutorial

SNI Proxy for sharing an SSL port 443 with Sandstorm

Make Sandstorm and other web server coexist in the same port while keeping HTTPS encryption.

Introduction

The purpose of this tutorial is to set up SNI Proxy so it’s possible to use Sandstorm verified SSL encryption while coexisting with another web server that also uses SSL.

The main reason is to allow other users to connect with your Sandstorm instance in the standard HTTPS port (443) and keep using that port also for any other web apps.

@wen-long
wen-long / bash_interactive_and_login.sh
Created March 18, 2018 12:36 — forked from CMCDragonkai/bash_interactive_and_login.sh
Bash & ZSH: Interactive and Login Shells
#!/usr/bin/env bash
[[ $- == *i* ]] && echo "This Bash Shell is Interactive Shell" || echo "This Bash Shell is Not a Interactive Shell"
shopt -q login_shell && echo "This Bash Shell is a Login Shell" || echo "This Bash Shell is Not a Login Shell"
@wen-long
wen-long / dns.go
Created July 15, 2023 08:16 — forked from timothyandrew/dns.go
Barebones Recursive DNS Resolver
package main
import (
"fmt"
"math/rand"
"os"
"github.com/miekg/dns"
)