Skip to content

Instantly share code, notes, and snippets.

View DanboDuan's full-sized avatar
💭
I may be slow to respond.

Danbo Duan DanboDuan

💭
I may be slow to respond.
View GitHub Profile
@DanboDuan
DanboDuan / parseRequestUrl.js
Created October 29, 2022 02:21 — forked from aweber1/parseRequestUrl.js
Node.js parse request url
import { IncomingMessage } from 'http';
import { TLSSocket } from 'tls';
import { URL } from 'url';
export function parseRequestUrl(req: IncomingMessage) {
let protocol = 'http';
if ((req.socket as TLSSocket).encrypted) {
protocol = 'https';
}
package main
import (
"bytes"
"context"
"fmt"
"io"
"log"
"net"
"strconv"
@DanboDuan
DanboDuan / tcpproxy.js
Created March 28, 2022 02:15 — forked from kfox/tcpproxy.js
A basic TCP proxy written in node.js
var net = require("net");
process.on("uncaughtException", function(error) {
console.error(error);
});
if (process.argv.length != 5) {
console.log("usage: %s <localport> <remotehost> <remoteport>", process.argv[1]);
process.exit();
}
@DanboDuan
DanboDuan / LLVM_for_iOS.sh
Created October 16, 2021 12:21 — forked from holzschu/LLVM_for_iOS.sh
Cross-compiling LLVM for iOS
#! /bin/bash
curl http://releases.llvm.org/6.0.0/llvm-6.0.0.src.tar.xz -O
tar xvzf llvm-6.0.0.src.tar.xz
rm llvm-6.0.0.src.tar.xz
cd llvm-6.0.0.src
# get clang
pushd tools
curl http://releases.llvm.org/6.0.0/cfe-6.0.0.src.tar.xz -O
#!/bin/bash -e
uuid="$(uuidgen)"
echo "New Keychain name: $uuid"
keychains=$(security list-keychains -d user)
keychainNames=();
@DanboDuan
DanboDuan / cmdbuild.sh
Created October 15, 2021 14:27 — forked from sinofool/cmdbuild.sh
A script to override xcode project configurations
#!/bin/bash
set -x
USAGE() {
cat << EOF
Usage: ${0##*/} <-i ident.p12> [-p password] <-m profile.mobileprovision> [-a com.example.app] [-n NewName] [-I Info.plist]
-i ident.p12 The signing identity file.
-p password The password of signing identity file.
-m profile.mobileprovision Signing provision profile
-a com.example.app Override CFBundleIdentifier
@DanboDuan
DanboDuan / encrypt_file_pkcs5_pkcs7.go
Created October 15, 2021 05:18 — forked from huyinghuan/encrypt_file_pkcs5_pkcs7.go
golang encrypt with pkcs5 and pkcs7
package main
import (
"bytes"
"crypto/aes"
"crypto/cipher"
"crypto/rand"
"errors"
"io"
"io/ioutil"