Skip to content

Instantly share code, notes, and snippets.

import java.util.Scanner;
public class Main {
/**
* @param args
*/
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
@ntuaha
ntuaha / random.js
Created December 27, 2014 14:21
Random
<!doctype html>
<html ng-app="randomPick">
<head>
<meta charset="utf-8"/>
<link rel="stylesheet" href="./css/bootstrap.3.2.0.css">
<link rel="stylesheet" href="./css/simulator.css">
<script src="./js/jquery.js"></script>
<script src="./js/angular.1.3.8.min.js"></script>
<script src="./js/random.js"></script>
<title>隨機抽獎</title>
@ntuaha
ntuaha / Crawler.py
Created December 30, 2014 14:54
抓連結的爬蟲
# -*- coding: utf-8 -*-
import re
#處理掉unicode 和 str 在ascii上的問題
import sys
import os
import psycopg2
import cookielib, urllib2,urllib
from lxml import html,etree
#先定義函數
ff = function(y,i){
if (i==1){
return((4*5+1)%%16)
}else{
y[i] = (y[i-1]*5+1)%%16
return(y)
}
}
@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)
@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 / 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 / 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 / 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 / 基礎分享使用.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.