Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View tanjuntao's full-sized avatar
🐍
Building production grade FL system

Juntao Tan tanjuntao

🐍
Building production grade FL system
  • USTC
  • Hefei, Anhui, China.
  • 00:08 (UTC +08:00)
  • LinkedIn in/tanjuntao
View GitHub Profile
@tanjuntao
tanjuntao / gen_phone.py
Created December 20, 2022 09:23
generate pseudo phone numbers
import random
import numpy as np
import pandas as pd
headers = ['134', '135', '136', '137', '138', '139',
'147', '150', '151', '152', '157', '158', '159',
'165', '172', '178', '182', '183', '184', '187', '188', '189',
'130', '131', '132', '145', '155', '156', '166', '171', '175', '176',
'185', '186', '133', '149', '153', '173', '177', '180', '181', '189', '199' ]
def serve():
server = grpc.server(futures.ThreadPoolExecutor(max_workers=10))
users_service.add_UsersServicer_to_server(UsersService(), server)
server.add_insecure_port('127.0.0.1:50051')
server.start()
try:
while True:
time.sleep(_ONE_DAY_IN_SECONDS)
except KeyboardInterrupt:
server.stop(0)
@tanjuntao
tanjuntao / cydot.pyx
Created February 21, 2022 13:06 — forked from zed/cydot.pyx
Naive O(N**3) 2D np.dot() multithreaded implementation (CPython extension in Cython)
#cython: boundscheck=False, wraparound=False
import numpy as np
cimport numpy as np
from cython.parallel cimport prange
def dot(np.ndarray[np.float32_t, ndim=2] a not None,
np.ndarray[np.float32_t, ndim=2] b not None,
np.ndarray[np.float32_t, ndim=2] out=None):
"""Naive O(N**3) 2D np.dot() implementation."""
@tanjuntao
tanjuntao / progress_bar.py
Created May 1, 2020 07:33
python training progress bar
import time
import os
import sys
term_width = 148
TOTAL_BAR_LENGTH = 65.
last_time = time.time()
begin_time = last_time
@tanjuntao
tanjuntao / displayData.m
Created October 17, 2018 13:13
可视化手写数字的数据集
function [h, display_array] = displayData(X, example_width)
%DISPLAYDATA Display 2D data in a nice grid
% [h, display_array] = DISPLAYDATA(X, example_width) displays 2D data
% stored in X in a nice grid. It returns the figure handle h and the
% displayed array if requested.
% Set example_width automatically if not passed in
if ~exist('example_width', 'var') || isempty(example_width)
example_width = round(sqrt(size(X, 2)));
end
@tanjuntao
tanjuntao / mapFeature.m
Last active October 13, 2018 01:07
MatLab中如何mapFeature,即:将少数的特征扩展出众多的高次项特征。
function out = mapFeature(X1, X2)
degree = 6;
out = ones(size(X1(:,1)));
for i = 1:degree
for j = 0:i
out(:, end+1) = (X1.^(i-j)).*(X2.^j);
end
end
@tanjuntao
tanjuntao / gist:54169b439752fbfc73714820637ffbe4
Created August 13, 2018 01:31 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue: