Skip to content

Instantly share code, notes, and snippets.

View jiankaiwang's full-sized avatar
🎯
Focusing

Jian-Kai Wang jiankaiwang

🎯
Focusing
View GitHub Profile
@jiankaiwang
jiankaiwang / object_oriented.cpp
Created July 15, 2021 06:16
the compare between prototype and object oriented programming language
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
class Employee {
protected:
std::string name = "";
std::string dept = "";
@jiankaiwang
jiankaiwang / build_bazel_arm32.dockerfile
Created July 4, 2021 06:40
the dockerfile for building bazel on arm 32-bit platform
# Copyright 2019 JianKai Wang
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@jiankaiwang
jiankaiwang / async.py
Last active October 15, 2021 08:52
the script demonstrates how to implement the async mechanisms in Python
#!/bin/python
# description:
# |- the script demonstrates how to implement the async mechanisms in Python
# |- asyncio was implemented <= python 3.6 and >= python 3.7
# maintainer: JianKai Wang <gljankai@gmail.com>
import sys
import time
import asyncio
@jiankaiwang
jiankaiwang / py2binary.md
Created January 20, 2021 10:10
In the following, we are going to show how to compile the python scripts into a binary executor running on different platforms via the package `pyinstaller`.

Python in Binary Executor

In the following, we are going to show how to compile the python scripts into a binary executor running on different platforms via the package pyinstaller.

Python-Side

In the python side, you can keep the way of developing. For example, you can create a virtual environment via virtualenv and then install lots of packages via the pip command. The similar approach is also available for the conda environment.

virtualenv -p python3 binary
@jiankaiwang
jiankaiwang / Setup_Kubernetes_Cluster.md
Created December 23, 2020 10:11
The following flow is how to use `kubeadm` to establish a Kubernetes cluster.

Create a kubernetes clsuter on the bare metal machines

The following flow is how to use kubeadm to establish a Kubernetes cluster.

Install the toolkits

In the beginning, use the package management tool to install the necessary components of Kubernetes.

curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
@jiankaiwang
jiankaiwang / Swift_for_Python_and_Tensorflow.md
Created November 23, 2020 05:41
Demonstrate on how to leverage Python and Tensorflow in a Swift runtime using XCode under a specific conda environment.

Swift for Tensorflow

Swift is on scheduling becoming the next generation programming language for Tensorflow. Swift APIs for Tensorflow are now released in beta. However, the transient peroid from Python to Swift is still not easy for the data scientists or AI enginners, etc. Fortunately, Swift leverages the Python interoperability. Before we get started to use Python in Swift, let's take a look into the workflow of data scientistics or AI-related engineers. Because of the rapid development of Tensorflow or other deep learning frameworks, their APIs or interfaces are on common changed a lot while a new version released. The scientistics or engineers first create the virtual or seperated environment through virtualenv, conda or even container. These behaviors bring challenges while introduing Python to Swift.

In the following, we demonstarte how to leverage Python in a Swift runtime using XCode under a specific conda environment.

Python Environment

# create a conda env
@jiankaiwang
jiankaiwang / Building_and_Importing_Swift_Libraries.md
Created March 8, 2020 13:53
Building and importing libraries to a Swift script is an advanced programming skill while developing a much bigger project. In the following, two main ways are provided to develop libraries, that are using Xcode in the MacOS system and using native commands for the overall Unix-like system.

Building and Importing Swift Libraries

Building and importing libraries to a Swift script is an advanced programming skill while developing a much bigger project. In the following, two main ways are provided to develop libraries, that are using Xcode in the MacOS system and using native commands for the overall Unix-like system.

Build a Swift Library

Here a built-in tool, swift package, is introduced to generate and build a library.

# the `project` is the folder created for the main.swift and the library
@jiankaiwang
jiankaiwang / TFGraph_Edit_Specification.py
Created September 18, 2019 09:12
Example of model specifications to inputs and outputs.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: jiankaiwang (https://jiankaiwang.no-ip.biz/)
@version:
Tensorflow: 1.x (developed >= 1.13.2)
@description:
Example of model specifications to inputs and outputs.
@dependency:
OperateFrozenModel (TF1_FrozenModel.py, https://gist.github.com/jiankaiwang/24cc1bc8b38ce72bba73f7fb326f7b9e)
@jiankaiwang
jiankaiwang / TF1_FrozenModel.py
Last active September 12, 2019 09:17
We provided several useful tools for using TF frozen model, including listing operations, listing nodes, transforming the model into tflite one, etc. We hope this script can bring you easier way access to the portable model.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: jiankaiwang (https://jiankaiwang.no-ip.biz/)
@version:
Tensorflow: 1.x (developed >= 1.13.2)
@description:
We provided several useful tools for using TF frozen model, including
listing operations, listing nodes, transforming the model into tflite one, etc.
We hope this script can bring you easier way access to the portable model.
@jiankaiwang
jiankaiwang / pdf_with_password.py
Created September 10, 2018 03:32
secure the pdf file with a password in python
# -*- coding: utf-8 -*-
"""
Created on Tue May 8 21:13:47 2018
@author: JianKai Wang
"""
import PyPDF2
import os
import sys
import codecs