Skip to content

Instantly share code, notes, and snippets.

View mlouielu's full-sized avatar
🎯
floating

Louie Lu mlouielu

🎯
floating
View GitHub Profile
#! /usr/bin/env python
# -*- coding:utf8 -*-
import json
import os
import re
import shutil
import time
import urllib.parse
import requests
$ cat stock.py
#! /usr/bin/python3
import sys
import twstock
if __name__ == '__main__':
if len(sys.argv) == 2:
s = twstock.Stock(sys.argv[1])
print(s.price[-5:])
import requests
url = 'https://dmz9.moea.gov.tw/gmweb/investigate/InvestigateFactory.aspx'
data = {'ContentPlaceHolder1_tvFactoryKind_ExpandState': 'enccccccccccccccccccccccccccc', 'ContentPlaceHolder1_tvFactoryKind_SelectedNode': None, 'ContentPlaceHolder1_tvFactoryKind_PopulateLog': None, 'ContentPlaceHolder1_tvFactoryCity_ExpandState': 'nccccccccccccccccccccccnnnn', 'ContentPlaceHolder1_tvFactoryCity_SelectedNode': '', 'ContentPlaceHolder1_tvFactoryCity_PopulateLog': '21', '__VIEWSTATE': 'YYjM0pqILvA3Eu7HPXHYreoy0OqGFwQM//1GCFFOS29N+hKXpYscfNDhG7AiPOCTBz/E9cvB9a9P/B4neja9RnXq2pQFXo34dvHgd4Gyh9EqWlziz9vDwQnhxKH+3ubpkWB0pBLukg78iuDsbWjj5jRC/hEZ8pOWlwEjjmuIwcvzXYF3z8ChQCvsz4Rcu5AalzuJz6S8fy1jWHiIWd0b0y/zel0/7viVeRYyVhvoYeprw+11k1qqq/nZNWufzs1ZO3ngPOzM3j0iC+HhwN0+73fhcLELrj0t2RIs3xTQ4hY7LSziWHCqd9deQNIOAXjxaMITi/bwtH5knagvUqk2G3KUGTBK8QCwxjoyixutx6oG820isP0/KT5c2ngxnehmqtCQG2070luTGjcKKmk2NdhZelsCpI8oHP78zkkc8tAynzIxwb1e0XlA5i6xCIXm4C9VwIyuj4Bw6fKZglpNeuUjdxE7hHfTH84qpWvkrDFvQEYZyekUSvGzlVokws5Ho6+VuZbec5qk5lt
#include <stdlib.h>
#include <kernel/syscalls.h>
#include "sh.h"
int _sleep(int ms) {
return do_syscall1((void *) ms, SYS_MSLEEP);
}
@mlouielu
mlouielu / taiwan_labor.py
Created November 28, 2017 17:48
抓取勞動違規統計
# -*- coding: utf-8 -*-
import re
import requests
from collections import defaultdict
from lxml import etree
URL = 'https://jobhelper.g0v.ronny.tw/package/show/%d'
REGEX = '第\\d+條第\\d+項第\\d+款|第\\d+條第\\d+項|第\\d+條'
@mlouielu
mlouielu / db.py
Created December 11, 2017 16:24
Init iotapy rocksdb provider to read database
import iotapy
r = iotapy.storage.providers.rocksdb.RocksDBProvider('/var/db/iota/mainnetdb', '/var/db/iota/mainnetdb.log', read_only=True)
r.init()
@mlouielu
mlouielu / milestone.py
Created December 11, 2017 16:22
Get latest 30 milestone hash and milestone->trunk->branch hash (this is the milestone confirm tx)
# -*- coding: utf-8 -*-
from db import r as tangle
def get_latest_30_milestone_hash():
index, milestone = tangle.latest('milestone')
for i in range(index, index - 30, -1):
m = tangle.get(i, 'milestone')
#
# Automatically generated file; DO NOT EDIT.
# OpenWrt Configuration
#
CONFIG_MODULES=y
CONFIG_HAVE_DOT_CONFIG=y
# CONFIG_TARGET_sunxi is not set
# CONFIG_TARGET_apm821xx is not set
# CONFIG_TARGET_ath25 is not set
# CONFIG_TARGET_ar71xx is not set
#
# Automatically generated file; DO NOT EDIT.
# OpenWrt Configuration
#
CONFIG_MODULES=y
CONFIG_HAVE_DOT_CONFIG=y
# CONFIG_TARGET_sunxi is not set
# CONFIG_TARGET_apm821xx is not set
# CONFIG_TARGET_ath25 is not set
# CONFIG_TARGET_ar71xx is not set
#
# Automatically generated file; DO NOT EDIT.
# OpenWrt Configuration
#
CONFIG_MODULES=y
CONFIG_HAVE_DOT_CONFIG=y
# CONFIG_TARGET_sunxi is not set
# CONFIG_TARGET_apm821xx is not set
# CONFIG_TARGET_ath25 is not set
# CONFIG_TARGET_ar71xx is not set