Skip to content

Instantly share code, notes, and snippets.

@ntuaha
ntuaha / index.js
Created November 26, 2018 03:10
FB bot on Google Cloud Functions
/**
* Responds to any HTTP request.
*
* @param {!express:Request} req HTTP request context.
* @param {!express:Response} res HTTP response context.
*/
function getToken(req,res){
// Your verify token. Should be a random string.
let VERIFY_TOKEN = "test"
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ntuaha
ntuaha / 1. Install python3.6 & pip3.md
Created September 26, 2018 23:27 — forked from alyssaq/1. Install python3.7 & pip3.md
Python3.6 setup on Mac 10.13 (High Sierra)
  1. Install Python 3.6.x from https://www.python.org/downloads/ or via homebrew.
$ brew install python3   # Installed at /usr/local/Cellar/python3

Check that python3 has been installed by running it at the terminal:

$ python3
>>> Python 3.6.5
  1. Download get-pip.py from https://bootstrap.pypa.io/get-pip.py and install (this should already be installed if python was installed from python.org or homebrew):
@ntuaha
ntuaha / 基礎分享使用.ipynb
Created April 18, 2018 14:27
簡單的keras 建立NN使用
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ntuaha
ntuaha / msCustomVIsion.js
Created October 1, 2017 16:03
微軟客制影像識別
var request = require("request");
var options = { method: 'POST',
url: 'https://southcentralus.api.cognitive.microsoft.com/customvision/v1.0/Prediction/[xxxx]/url',
qs: { iterationId: [iteration id] },
headers:
{ 'cache-control': 'no-cache',
'content-type': 'application/json',
'prediction-key': [prediction key] },
body: { Url: [image URL] },
@ntuaha
ntuaha / facebook_id_chain.py
Created August 14, 2017 16:49
查詢所有在同一個企業戶底下的Facebook ID 資訊
import requests
fbid = [fbid]
url = "https://graph.facebook.com/v2.10/%s"%fbid
querystring = {"access_token":[token],"fields":"name,age_range,ids_for_apps,ids_for_pages"}
headers = {'cache-control': "no-cache"}
response = requests.request("GET", url, headers=headers, params=querystring)
print(response.text)
@ntuaha
ntuaha / getDateString.js
Last active September 20, 2021 21:36
Javascript 漂亮日期顯示 YYYYMMDDhhmmss or YYYY-MM-DD hh:mm:ss
'use strict'
function pad(v){
return (v<10)?'0'+v:v
}
function getDateString(d){
var year = d.getFullYear();
var month = pad(d.getMonth()+1);
var day = pad(d.getDate());
@ntuaha
ntuaha / 0_reuse_code.js
Created February 14, 2016 09:29
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@ntuaha
ntuaha / csv2ptt.py
Created July 20, 2015 16:54
convert json to csv on ptt article
__author__ = 'ESB13240'
#encoding=utf-8
import datetime
#處理掉unicode 和 str 在ascii上的問題
import sys
import json
import os
reload(sys)
#先定義函數
ff = function(y,i){
if (i==1){
return((4*5+1)%%16)
}else{
y[i] = (y[i-1]*5+1)%%16
return(y)
}
}