Skip to content

Instantly share code, notes, and snippets.

View RockfordWei's full-sized avatar

Rockford Wei RockfordWei

View GitHub Profile
@RockfordWei
RockfordWei / testssl.c
Created August 28, 2023 13:50
testssl
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <openssl/ssl.h>
#include <openssl/err.h>
@RockfordWei
RockfordWei / fibonacci.py
Created September 29, 2021 14:34
fastest fibonacci precise calculation (to millionth) including negative
def fib(n):
if n == 0: return 0
if n == 1: return 1
if n >=2 and n % 2 == 0:
k = int(n / 2)
fbk = fib(k)
return (2 * fib(k - 1) + fbk) * fbk
if n >= 2:
k = int((n + 1) / 2)
fbk1 = fib(k - 1)
@RockfordWei
RockfordWei / iOSCreatePDF.swift
Last active August 25, 2021 19:23 — forked from nyg/iOSCreatePDF.swift
iOS, Swift: Create a PDF file from an HTML string with local image file support
//
// ViewController.swift
// hrender
//
// Created by Rockford Wei on 2021-08-25.
//
import UIKit
import WebKit
class ViewController: UIViewController {
@RockfordWei
RockfordWei / drawable_gen.sh
Created July 14, 2019 15:26
android drawables generator
#!/bin/bash
# brew install imagemagick
if [ -z "$1" ]
then
echo "drawable generator for android"
echo "usage: $0 [highest resolution image] [parent path of drawables]"
exit
else
img=$1
fi
@RockfordWei
RockfordWei / EasyGIF.swift
Created June 6, 2019 14:22
An asset friendly GIF library.
//
// EasyGIF.swift
//
// Created by Rocky Wei on 2019-06-06.
// Copyright © 2019 Treefrog. All rights reserved.
//
import UIKit
/// An Easy GIF animation class
@RockfordWei
RockfordWei / ClientConnection.swift
Created December 28, 2018 18:22
How to setup a secure socket on macOS/iOS/tvOS
//
// ClientConnection.swift
//
// Created by Rocky Wei on 2018-12-27.
// Copyright © 2018 Rocky Wei. All rights reserved.
//
import Foundation
public class ClientConnection: NSObject, StreamDelegate {
@RockfordWei
RockfordWei / Package.swift
Created August 31, 2018 17:53
testing perfect v3 http server
import PackageDescription
let package = Package(
name: "atest",
targets: [],
dependencies: [
.Package(url: "https://github.com/PerfectlySoft/Perfect-HTTPServer.git", majorVersion:3),
]
)
@RockfordWei
RockfordWei / sql_transpose_and_pivot.ipynb
Created July 27, 2018 12:54
MySQL query transpose and pivot
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@RockfordWei
RockfordWei / EncodedScaler.py
Last active July 13, 2018 18:53
Non-linear scale
import numpy as np
import pandas as pd
import random
import math
class EncodedScaler:
milestones = [0,0,0]
unit = 0
count= 0
size = 0
@RockfordWei
RockfordWei / gitflow-breakdown.md
Created April 16, 2018 13:48 — forked from JamesMGreene/gitflow-breakdown.md
A comparison of using `git flow` commands versus raw `git` commands.

Initialize

gitflow git
git flow init git init
  git commit --allow-empty -m "Initial commit"
  git checkout -b develop master

Connect to the remote repository