Skip to content

Instantly share code, notes, and snippets.

View l34marr's full-sized avatar

TsungWei Hu l34marr

View GitHub Profile
@l34marr
l34marr / rst_renderer.py
Created December 27, 2022 07:12 — forked from scanny/rst_renderer.py
Code to translate RestructuredText into Microsoft Word document using python-docx
# encoding: utf-8
"""
Helper objects for rendering to .docx format.
"""
from __future__ import (
absolute_import, division, print_function, unicode_literals
)
@l34marr
l34marr / ipython.rst
Last active June 9, 2022 13:49
IPython

Installation

Basic Concepts

>>> a = 1 # What's the difference between the following operations? In [1]: print a In [2]: a

import computer as tool
def hacker(problem):
’’’ a generator
’’’
try:
tool.fix(problem)
except:
report(bug)
yield patch # don’t reboot it
@l34marr
l34marr / ubuntu.sh
Last active November 18, 2020 07:14
Package List After Fresh Installation
sudo apt-get update
sudo apt-get -y install openssh-server vim curl screen
sudo apt-get -y install build-essential libssl-dev libxml2-dev libxslt1-dev libbz2-dev zlib1g-dev
# Ubuntu 20.04 selecting 'python-dev-is-python2' instead of 'python-dev'
sudo apt-get -y python-dev-is-python3
# Ubuntu 20.04 switching OK via sudo apt autoremove
sudo apt-get -y install libjpeg62-dev
# Ubuntu 18: libreadline6; Ubuntu 20: libreadline (v8)
sudo apt-get install libreadline
# Ubuntu 16: python-imaging; Ubuntu 18: python-pil; Ubuntu 20: python3-pil
@l34marr
l34marr / crm.lead.csv
Last active February 14, 2020 02:54
Error Message
id name partner_id country_id activity_summary stage_id planned_revenue probability team_id
__export__.crm_lead_2_64f28df9 Data Scientist; Machine Learning Engineer Chang Amin Accessment New 0.0 Sales
@l34marr
l34marr / develop.cfg
Created December 10, 2018 15:49
develop.cfg for Plone 5.1.2 + Volto
#################################################################
#
# Development Configuration
# =========================
#
# This is a buildout configuration that sets up a development
# environment for Plone. It extends buildout.cfg.
#
# To use this configuration, run buildout via:
#
var NOW = new Date();
var TY = NOW.getFullYear();
var TM = NOW.getMonth()+1;
function chg_cals(Y,M){
var tb=document.getElementById("cal");
var F=true;
var R=0;
var D=1;
var DW;
var DM = new Array(Y,31,28,31,30,31,30,31,31,30,31,30,31);
@l34marr
l34marr / city-town.py
Last active May 7, 2018 07:39
List Temple Data
cities = {
'KeelungCity': '基隆市',
'TaipeiCity': '臺北市',
'NewTaipeiCity': '新北市',
'TaoyuanCity': '桃園市',
'HsinchuCounty': '新竹縣',
'HsinchuCity': '新竹市',
'MiaoliCounty': '苗栗縣',
'TaichungCity': '臺中市',
'NantouCounty': '南投縣',
@l34marr
l34marr / reachs.py
Last active August 31, 2017 13:45
Read Excel File
from openpyxl import load_workbook
wb = load_workbook('vol3.xlsx')
print wb.get_sheet_names()
#ws = wb.get_sheet_by_name(u'Sheet1')
ws = wb.worksheets[0]
print ws.max_row, ws.max_column
result = []
for row in ws.iter_rows():
<!DOCTYPE HTML>
<html>
<head>
<title>OpenLayers Bounding Box Selector Example</title>
<script src="http://www.openlayers.org/api/OpenLayers.js"></script>
<script>
var vectors;
var box;