This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from os import listdir | |
from numpy import asarray | |
from numpy import vstack | |
from keras.preprocessing.image import img_to_array | |
from keras.preprocessing.image import load_img | |
from numpy import savez_compressed | |
def load_images(path, size=(256,512)): | |
src_list = list() | |
tar_list = list() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const line = require('@line/bot-sdk'); | |
const express = require('express'); | |
const https = require('https'); | |
const fetch = require('node-fetch'); | |
const webHookURL = 'https://your-slack-incoming-webhook-url'; | |
require('dotenv').config(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<VirtualHost *:80> | |
ServerAdmin webmaster@localhost | |
DocumentRoot /var/www/sophie | |
ErrorLog ${APACHE_LOG_DIR}/error.log | |
CustomLog ${APACHE_LOG_DIR}/access.log combined | |
ProxyRequests on | |
ProxyPreserveHost on | |
<Location /callback> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> //cout | |
#include <string.h> //strlen | |
#include <string> //string | |
#include <sys/socket.h> //socket | |
#include <arpa/inet.h> //inet_addr | |
#include <netdb.h> //hostent | |
#include <stdio.h> | |
#include <unistd.h> | |
#include <sys/wait.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
root /var/www/html; | |
# Add index.php to the list if you are using PHP | |
index index.html index.htm index.nginx-debian.html; | |
server_name project.site; # managed by Certbot | |
location / { | |
proxy_pass http://127.0.0.1:8000; | |
proxy_set_header Host $host; | |
proxy_set_header X-Real-IP $remote_addr; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from google.cloud import storage | |
from datetime import datetime | |
# backup database | |
date = datetime.now().strftime("%Y-%m-%d") | |
base_dir = "/var/www/sophie/" | |
folder_name = "backup/" | |
filename = date + ".sql" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PIL import Image | |
import PIL | |
import os | |
foldernum = 0 | |
dir_name = "./HOPE圖庫" | |
for folder in os.listdir(dir_name): | |
if folder[-1] != 'g': | |
for file in os.listdir(dir_name+"/"+folder): | |
if file[-1] == 'g': // only handle jpg/png files |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const channelToken = 'your_messaging_api_channel_token'; | |
// `e` is the data provided by Line | |
function doPost(e) { | |
var value = JSON.parse(e.postData.contents); | |
try { | |
var events = value.events; | |
if (events != null) { | |
for (var i in events) { | |
var event = events[i]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function replyMsg(userId, replyToken, userMsg) { | |
var msg = ""; | |
if (userMsg == "打卡提醒") { // "Remind me to punch." | |
if (checkUser(userId) == -1) { | |
addUser(userId); | |
msg = "那我以後9:00和18:00會提醒你喔~"; // "I'll remind you at 9:00 and 18:00 in the future." | |
} else { | |
msg = "你已經在提醒名單中了:)"; // "You're already on the remind list." | |
} | |
} else if (userMsg == "取消提醒") { // "Stop reminding me." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var app = SpreadsheetApp.openById("your-sheet-id"); | |
var remindSheet = app.getSheets()[0]; // Get's the fisrt table in the sheet | |
function checkUser(userId) { | |
var lastRow = remindSheet.getLastRow(); // the index of the last row | |
var inDB = -1; | |
if (lastRow > 0) { | |
var ids = remindSheet.getSheetValues(1,1,lastRow,1); | |
OlderNewer