Skip to content

Instantly share code, notes, and snippets.

View goescat's full-sized avatar

goescat

View GitHub Profile
function getDataAndWriteSheet() {
// Get data from API
var response = UrlFetchApp.fetch("https://mis.twse.com.tw/stock/api/getStockInfo.jsp?ex_ch=tse_2412.tw&json=1&delay=0");
// Load json
var response_json = JSON.parse(response);
// Open sheet
var spreadsheet = SpreadsheetApp.openById('sheet_token');
from __future__ import print_function
import pickle
import os.path
from googleapiclient.discovery import build
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request
# If modifying these scopes, delete the file token.pickle.
SCOPES = ['https://www.googleapis.com/auth/spreadsheets.readonly']
@goescat
goescat / mattermost_outgoing_hook_with_flask
Created February 15, 2020 11:34
Very simple Mattermost outgoing webhook
import requests
from flask import Flask, request
app = Flask(__name__)
@app.route('/')
def index():
return 'Home Page'
@app.route('/mattermost', methods = ['GET', 'POST'])
@goescat
goescat / mattermost_incoming_hook
Created February 15, 2020 11:05
Very simple Mattermost incoming webhook with slackweb
import slackweb
mattermost = slackweb.Slack(url="https://mattermost.your.domain/hooks/xxxxtokenxxxx")
mattermost.notify(text="Hello, test!!")
@goescat
goescat / mattermost_incoming_hook
Last active February 15, 2020 11:00
Very simple Mattermost incoming webhook
import requests
import json
headers = {
"Content-Type": "application/json"
}
data = {
"text": "Hello, test!!"
}
https://stackoverflow.com/questions/42554337/cannot-launch-avd-in-emulatorqt-library-not-found
env LDFLAGS="-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib" pip install mysql-python
brew install mysql
brew unlink mysql
brew install mysql-connector-c
brew link --overwrite mysql
response_text = response_text.replace(u"\xef\xbb\xbf", u"")
with open(file.csv, 'wb') as csv_file:
csv_file.write(response_text)
csv_file.close()