Skip to content

Instantly share code, notes, and snippets.

View tuoxie007's full-sized avatar

Jason Hsu tuoxie007

View GitHub Profile
#include <iostream>
using namespace std;
// compile without optimization
// clang++ -std=c++17 -stdlib=libc++ -O0 test_alloc.cpp
// elapse 6.25 seconds with N=100*1000*1000
size_t test_alloc(size_t N) {
size_t r;

explicit

构造函数是用来禁止隐式类型转换的

// 条款3

const

const char * p 表示 (char * p) 整体是const,即内容不可变

/*
PHP
└── is
├── minor
│ └── perpetrated
│ └── whereas
│ └── skilled
│ └── perverted
│ └── professionals.
└── a
#!/bin/bash
BRANCH=release_50
ROOT=`pwd`
SRC=$ROOT/llvm
# GIT_BASE_URL=https://llvm.org/git
if [[ "$GIT_BASE_URL" == "" ]]; then
GIT_BASE_URL=https://github.com/llvm-mirror
fi
BUILDER=ninja
- Alert "A valid provisioning profile for this executable was not found." when you debuging iOS app on a device.
Delete Derived Data and rebuild.
@tuoxie007
tuoxie007 / mach_exception_handler
Created September 18, 2017 01:45
how to handler mach exception
#import <mach/mach.h>
#import <pthread/pthread.h>
void catchMachExceptions(void);
void *exc_handler(void *ignored);
static mach_port_name_t myExceptionPort;
void catchMachExceptions(void) {

当前配置内容

AllowShortFunctionsOnASingleLine: false
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakBeforeMultilineStrings: false
@tuoxie007
tuoxie007 / _INSTRUCTIONS.md
Last active February 22, 2017 08:21 — forked from jiaaro/_INSTRUCTIONS.md
Using Swift libraries in Python

Using Swift libraries in Python

So... this is obviously totally, 100%, like for. real. not. supported. by. Apple. …yet?

But still... I thought it was pretty badass. And, seeing how there's already a Swift buildpack for Heroku you could move some slow code into Swift can call it as a library function. But, you know, not in production or anything. That would be silly, right?

Now, having said that, the actual Python/Swift interop may have bugs. I'll leave that as an exercise to the reader.

How to get Python code calling Swift functions:

@tuoxie007
tuoxie007 / linux_use_swap_manual.md
Last active January 10, 2016 12:38
linux use swap manual

Use swap partition

  1. add a new device
  2. partition with fdisk $ sudo fdisk /dev/sdb $ n # create a new partition $ p # primary partition $ # use default startor selector $ # use default end selector $ w # write to disk $ ls /dev/sdb* # show the new partition file
@tuoxie007
tuoxie007 / socks5.js
Created September 23, 2015 06:56 — forked from robertpitt/socks5.js
SOCKS5 Server as per rfc1928 (nodejs)
/**
* SOCKS5 Proxy as per RFC1928
* @see : http://www.ietf.org/rfc/rfc1928.txt
*/
/**
* Load Dependancies
*/
var net = require('net'),