Skip to content

Instantly share code, notes, and snippets.

View elisong's full-sized avatar

Eli Song elisong

  • Shanghai, China
View GitHub Profile
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<rss version="2.0"
xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>RStudio Blog</title>
<link>https://blog.rstudio.com/</link>
<description>Recent content on RStudio Blog</description>
<generator>Hugo -- gohugo.io</generator>
<language>en-us</language>
<managingEditor>info@rstudio.com (RStudio, Inc.)</managingEditor>
@elisong
elisong / numbers.py
Created March 17, 2020 18:42
extract data from numbers opened
import subprocess
from os import path, listdir
import shutil
import pandas as pd
class Numbers:
def __init__(self, name):
self.name = name
self.folder = path.expanduser('~/Desktop/' + name + '.csv')
self.clear()
@elisong
elisong / file.sql
Last active September 2, 2018 14:56
create table if not exists test_table(
x string
);
insert into table test_table
select '${bdp.system.bizdate}' from dual;
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# ############################################################################
# 内容: 实例(instance)元信息分区表
# 表: meta_instances
# 调度: 0 0 * * * /usr/bin/python3 odps_meta_instances.py
# 日志: odps_meta_instances.log
# ############################################################################
from multiprocessing import Pool
from datetime import datetime, timedelta, time
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# ###########################################################################################
# 内容: 表字段(field)元信息历史表
# 脚本: odps_meta_fields.py
# 调度: 0 0 * * * /usr/bin/python3 odps_meta_fields.py
# 日志: odps_meta_fields.log
# ###########################################################################################
from multiprocessing import Pool
from datetime import datetime
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# ###########################################################################################
# 内容: 表(tables)元信息历史表
# 脚本: odps_meta_tables.py
# 调度: 0 0 * * * /usr/bin/python3 odps_meta_tables.py
# 日志: odps_meta_tables.log
# ###########################################################################################
from datetime import datetime, timedelta
from odps import ODPS
#!/usr/local/anaconda3/bin/python3
# -*- coding:utf-8 -*-
#################################################
# ## 脚本: 拉取阿里云MaxCompute周期性任务的脚本(SQL/PY/SH)
# ## 环境:Ubuntu16.04
# ## 日期: 2018-03-31
# ## 作者: elisong.ah@gmail.com
#################################################
import os
import shutil
# -*- coding: utf-8 -*-
from odps import ODPS
from urllib.parse import parse_qs
import time
import requests
import xml.etree.cElementTree as etree
odps = ODPS(access_id='<your access id>',
secret_access_key='<your access key>',
project='<your project>',
#!/bin/bash
############################################################################################
# 执行环境: Linux server with python (pyodps)
# 脚本: unit_run.sh
# 参数: s(起始日期)=yyyymmdd, e(结束日期)=yyyymmdd, f(每日ETL脚本)=file.sql
# 日志: yyyymmdd_yyyymmdd_file.log
############################################################################################
while getopts "s:e:f:" arg
do
case $arg in
from odps import ODPS
from odps.df import DataFrame
conf = '<pyodps.ini>'
parm = {}
with open(conf) as f:
for line in f:
key, value = line.strip().split('=')
parm[key] = value