Skip to content

Instantly share code, notes, and snippets.

@Ray901
Ray901 / update_workbook_datasources.R
Last active April 3, 2024 07:59
Update Tableau Workbook datasource password by R
rm(list=ls())
library(vvtableau)
tableau <- authenticate_server(
base_url = "https://tableau.server.com/",
username = "ABC",
password = "OOXX"
)
rm(list=ls())
library(httr)
library(data.table)
library(dplyr)
library(plotly)
url = 'https://api.finmindtrade.com/api/v4/data'
config_proxy <- httr::config(
@Ray901
Ray901 / MSMQ_TO_SQL.py
Last active April 6, 2020 07:57
get MSMQ data to SQL SERVER
# coding=utf-8
import win32com.client
import os
import pythoncom
import json
import pyodbc
from datetime import datetime
from datetime import timedelta
import time
rm(list=ls())
library(readODS)
library(lubridate)
library(tidyr)
library(RODBC)
setFiles <- paste0(
unique(gsub("-","",substr(ymd(seq.Date(as.Date('2015-01-01'),as.Date('2019-03-01'),by = "month")),1,7))),
"_cht.ods"
@Ray901
Ray901 / R_TGOS_ADDR.R
Created March 4, 2019 08:02
USE TGOS API CONVERT ADDRESS TO LAT, LON
rm(list=ls())
options(digits = 9)
library(httr)
library(xml2)
library(dplyr)
library(magrittr)
TGOS_ADDR <- function(setADDR) {
@Ray901
Ray901 / gmapAddressTransLatLng.py
Created March 16, 2018 07:21
Use geocoder trans address to lan and lng
# coding=utf-8
import geocoder
import pyodbc
updateNum = 10
# sql setting
local_server = ''
local_database = ''
@Ray901
Ray901 / azureMLBES.py
Created January 20, 2017 07:27
retrain azure ML model using azure BES
# coding=UTF-8
# How this works:
#
# 1. Assume the input is present in a local file (if the web service accepts input)
# 2. Upload the file to an Azure blob - you"d need an Azure storage account
# 3. Call BES to process the data in the blob.
# 4. The results get written to another Azure blob.
# 5. Download the output blob to a local file
#
# Note: You may need to download/install the Azure SDK for Python.
rm(list=ls())
setwd("image/")
library(plot3D)
trunk <- list(
x0=0, y0=0, z0=0,
x1=0, y1=0, z1=6,
extension=NULL,
branch1=NULL, branch2=NULL,
@Ray901
Ray901 / darkskyWeather.R
Created December 1, 2016 03:26
get weather data by darksky api
rm(list=ls())
library(darksky)
library(data.table)
library(dplyr)
darksky_api_key()
setStart <- "2016-11-27"
setEnd <- "2016-11-30"
rm(list=ls())
library(curl)
library(rvest)
setUrl <- "http://tisvcloud.freeway.gov.tw/"
#######################################################
gethtmlTableUrl <- function(seturl) {