Skip to content

Instantly share code, notes, and snippets.

@choupi
choupi / keras VGG-Face Model.md
Created September 8, 2017 11:04 — forked from EncodeTS/keras VGG-Face Model.md
VGG-Face model for keras

VGG-Face model for Keras

This is the Keras model of VGG-Face.

It has been obtained through the following method:

  • vgg-face-keras:directly convert the vgg-face matconvnet model to keras model
  • vgg-face-keras-fc:first convert vgg-face caffe model to mxnet model,and then convert it to keras model

Details about the network architecture can be found in the following paper:

@choupi
choupi / client.py.patch
Last active June 11, 2017 13:37
FB chatbot for pycon 2017 QA game with modified fbchat
--- client.py.orig 2017-06-11 21:28:19.232693710 +0800
+++ client.py 2017-06-09 15:25:46.000000000 +0800
@@ -442,7 +442,7 @@
users.append(User(entry))
return users # have bug TypeError: __repr__ returned non-string (type bytes)
- def send(self, recipient_id=None, message=None, is_user=True, like=None, image_id=None, add_user_ids=None):
+ def send(self, recipient_id=None, message=None, is_user=True, like=None, image_id=None, add_user_ids=None, payload=None):
"""Send a message with given thread id
import sys
import csv
import math
from sklearn import metrics
EPS=1e-15
rd=[]
y=[]
with open(sys.argv[1], 'rb') as f:
mpla :: [[Float]] -> [Float] -> [Float] -> (Bool, [Float])
mpla [] [] c = (False, c)
mpla (a:ax) (b:by) (c:cc) = (fl&&(s<0), rc)
where
s = b*(c+(mdot a cc))
nc = case (s<0) of
True -> [c+(b*head a)] ++ (vadd a cc b)
False -> [c] ++ cc
(fl, rc) = mpla ax by nc
@choupi
choupi / mgcd.hs
Created January 7, 2015 03:01
GCD in haskell
mgcd :: Int -> Int -> Int
mgcd a b
| b > a = mgcd b a
| b==1 = 1
| b==0 = a
| otherwise = mgcd b (a `mod` b)
main = print (mgcd 45 6)
@choupi
choupi / mg.hs
Created January 7, 2015 02:59
mergesort in haskell
mergesort :: Ord a => [a] -> [a]
mergesortM :: Ord a => [a] -> [a] -> [a]
mergesortM a [] = a
mergesortM [] a = a
mergesortM (a:ax) (b:bx)
| a>b = [a] ++ (mergesortM ax ([b] ++ bx))
| otherwise =[b] ++ (mergesortM ([a] ++ ax) bx)
mergesort [] = []
mergesort [a] = [a]
@choupi
choupi / submit time
Last active August 29, 2015 14:06
阿美語submit分析
186 31/Aug/2014:14:
196 31/Aug/2014:15:
129 31/Aug/2014:16:
34 31/Aug/2014:17:
31 31/Aug/2014:18:
32 31/Aug/2014:19:
28 31/Aug/2014:20:
92 31/Aug/2014:21:
306 31/Aug/2014:22:
242 31/Aug/2014:23:
--- Day changed Thu Aug 21 2014
05:52 < iddqd> morning
07:21 < MrQ_> m0rning 0.0
07:34 < susu> good morning~
08:00 < newbuy_> 早安! 揪竟能不能到現場呢?
08:04 < Lunpin> good morning
08:06 < newbuy_> @Lunpin 早 跟您一樣鍵盤參加了:'(
08:14 < Lunpin> Q___Q
08:15 < AlpacaZoo> [HTTP] 140.109.127.10:8944 -> 54.254.253.233:80 666 / # market.voga360.com/j****
08:15 < iddqd> wow
--- Day changed Sat Jul 19 2014
00:17 < Guest10976> 請問沒有帶識別証 還有救嗎
00:18 < Guest10976> 各位大大救命呀
01:47 < S3p_lin> 嗯? 網站上面沒有 R0 R1 R2 H1 H2 H3 H4 的分布圖?
01:48 < wens> S3p_lin: R0 R1 R2 照舊吧
01:49 < wens> S3p_lin: 活動中心就是外面有摩斯那邊
01:53 < S3p_lin> wens: hmm
01:57 < wens> 竟然兩點了 明天爬不起來QQ
01:57 < Heero> 五點得搭統聯北上...
02:02 < shtzeng_tw> 最近特別累啊 orz
@choupi
choupi / n.c
Created July 6, 2014 04:24
find max n such that s <= LONG_MAX, for s=1+2+3+...+n (O(1) algorithm)
#include <stdio.h>
#include <limits.h>
#include <math.h>
int main()
{
double nn=(1+sqrt(1+4.0*LONG_MAX*2.0))/2.0;
long int n= nn, s=n/2*(n-1),t;
printf("%lf %lf\n", nn, log(nn)/log(2.0));
printf("%ld %ld %ld\n", n, s, s+n+1);