Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

mwpcheung

🏠
Working from home
View GitHub Profile
View iocp_client.c
#include <iostream>
using namespace std;
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <Winsock2.h>
#pragma comment(lib, "Ws2_32.lib")
void InitWs2();
void UninitWs32();
@mwpcheung
mwpcheung / usbimplementation.go
Last active Jan 12, 2021
golang tcp forward idevice
View usbimplementation.go
package main
import (
"log"
"sync"
)
type USBController struct {
DeviceID map[string]int
sync.RWMutex
@mwpcheung
mwpcheung / tlswithproxy.go
Created Jan 11, 2021
connect tls server with socks/https proxy
View tlswithproxy.go
package main
import (
"bufio"
"bytes"
"crypto/tls"
"encoding/base64"
"encoding/hex"
"fmt"
"log"
@mwpcheung
mwpcheung / listRecentlyDeleted.mm
Last active Jan 12, 2021
iOS list/delete Recently Deleted photo
View listRecentlyDeleted.mm
void listRecentlyDeleted()
{
// iOS list system recently deleted photo and delete them
[PHPhotoLibrary requestAuthorization:^(PHAuthorizationStatus status) {
PHFetchOptions* opt = [[PHFetchOptions alloc]init];
opt.includeAllBurstAssets = YES;
opt.includeHiddenAssets = YES;
opt.includeAssetSourceTypes = YES;
PHFetchResult *result = [PHAssetCollection fetchAssetCollectionsWithType:PHAssetCollectionTypeSmartAlbum subtype:(PHAssetCollectionSubtype)1000000201 options:opt];
NSMutableArray* items = [[NSMutableArray alloc]init];
@mwpcheung
mwpcheung / nsdata+hook.mm
Created Oct 14, 2020
fix iOS13 nsdata descrption
View nsdata+hook.mm
void __attribute__((constructor)) constructor()
{
[NSData load];
}
@implementation NSData (hook)
+(void)load {
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
Method description = class_getInstanceMethod(self, @selector(description));
@mwpcheung
mwpcheung / ios-static.sh
Created Apr 16, 2020 — forked from eyeplum/ios-static.sh
Build Google Protobuf C++ Runtime for iOS
View ios-static.sh
#!/bin/bash
## Environments
# Exit the build pass if any command returns a non-zero value
#set -o errexit
# Echo commands
set -x
@mwpcheung
mwpcheung / install_m2crypto.txt
Created Jul 6, 2018 — forked from andrisasuke/install_m2crypto.txt
python install m2crypto on Mac OS X
View install_m2crypto.txt
$> brew install openssl
$> brew install swig
$> env LDFLAGS="-L$(brew --prefix openssl)/lib" \
CFLAGS="-I$(brew --prefix openssl)/include" \
SWIG_FEATURES="-cpperraswarn -includeall -I$(brew --prefix openssl)/include" \
pip install m2crypto