斯卡部落集市 scarborough fair

1. scrborough fair

Are you going to Scarborough Fair?
Parsley, sage, rosemary & thyme
Remember me to one who lives there
She once was a true love of mine

Tell her to make me a cambric shirt
(On the side of a hill in the deep forest green)
Parsley, sage, rosemary & thyme
(Tracing a sparrow on snow-crested ground)
Without no seams nor needlework
(Blankets and bedclothes a child of the mountains)
Then she’ll be a true love of mine
(Sleeps unaware of the clarion call)

Tell her to find me an acre of land
(On the side of a hill, a sprinkling of leaves)
Parsley, sage, rosemary, & thyme
(Washes the grave with silvery tears)
Between the salt water and the sea strand
(A soldier cleans and polishes a gun)
Then she’ll be a true love of mine

Tell her to reap it in a sickle of leather
(War bellows, blazing in scarlet battalions)
Parsley, sage, rosemary & thyme
(Generals order their soldiers to kill)
And gather it all in a bunch of heather
(And to fight for a cause they’ve long ago forgotten)
Then she’ll be a true love of mine

Are you going to Scarborough Fair?
Parsley, sage, rosemary & thyme
Remember me to one who lives there
She once was a true love of mine

2. five hundred miles

if you missed the train i’m on
you will know that i am gone
you can hear the whistle blow a hundred miles
a hundred miles a hundred miles
a hundred miles a hundred miles
you can hear the whistle blow a hundred miles
lord i’m one lord i’m two
lord i’m three lord i’m four
lord i’m five hundred miles away from home
away from home away from home
away from home away from home
lord i’m five hundred miles away from home
not a shirt on my back
not a penny to my name
lord i can’t go back home this-a way
this-a way this-a way
this-a way this-a way
lord i can’t go back home this-a way
if you missed the train i’m on
you will know that i am gone
you can hear the whistle blow a hundred miles
a hundred miles
a hundred miles
a hundred miles
a hundred miles
you can hear the whistle blow a hundred miles
you can hear the whistle blow a hundred miles
you can hear the whistle blow a hundred miles

加州旅馆 Hotel California

Hotel California

On a dark desert highway, cool wind in my hair
Warm smell of colitas, rising up through the air
Up ahead in the distance, I saw a shimmering light
My head grew heavy and my sight grew dim
I had to stop for the night
There she stood in the doorway;
I heard the mission bell
And I was thinking to myself, “This could be Heaven or this could be Hell”
Then she lit up a candle and she showed me the way
There were voices down the corridor,
I thought I heard them say…
“Welcome to the Hotel California
Such a lovely place, Such a lovely face
Plenty of rooms at the Hotel California
Any time of year, you can find it here “
Her mind is Tiffany-twisted, she got the Mercedes benz
She got a lot of pretty, pretty boys, that she calls friends
How they dance in the courtyard, sweet summer sweat.
Some dance to remember, some dance to forget
So I called up the Captain, “Please bring me my wine”
He said, ‘We haven’t had that spirit here since 1969’
And still those voices are calling from far away,
Wake you up in the middle of the night
Just to hear them say…
“Welcome to the Hotel California
Such a lovely place, Such a lovely face
They living it up at the Hotel California
What a nice surprise, bring your alibis”
Mirrors on the ceiling, The pink champagne on ice
And she said ‘We are all just prisoners here, of our own device’
And in the master’s chambers, They gathered for the feast
They stab it with their steely knives,
But they just can’t kill the beast
Last thing I remember, I was running for the door
I had to find the passage back to the place I was before
‘Relax,’ said the night-man,” We are programmed to receive.
You can checkout any time you like,
but you can never leave!”

刘德华-我和我追逐的梦

1. 我和我追逐的梦

飘流已久
在每个港口只能稍作停留
喜乐和哀愁今生不能由我
任风带我 停停走走
孤独依旧
多希望你能靠在我的胸口
却不愿痴心得到你的温柔
人群之中装作冷漠
泪不敢流
让命运牵引着我南北西东
看世间悲欢离合难分难舍
而谁在为我守候
喔 喔 我和我追逐的梦擦肩而过
永远也不能重逢
我和我追逐的梦一再错过
只留下我独自寂寞
却不敢回头
孤独依旧
多希望你能靠在我的胸口
却不愿痴心得到你的温柔
人群之中装作冷漠
泪不敢流
让命运牵引着我南北西东
看世间悲欢离合难分难舍
而谁在为我守候
喔 喔 我和我追逐的梦擦肩而过
永远也不能重逢
我和我追逐的梦一再错过
只留下我独自寂寞
却不敢回头
我和我追逐的梦擦肩而过
永远也不能重逢
我和我追逐的梦一再错过
只留下我独自寂寞
却不敢回头

2. 来生缘

寻寻觅觅
在无声无息中消逝
总是找不到回忆
找不到曾被遗忘的真实
一生一世的过去
你一点一滴的遗弃
痛苦痛悲痛心痛恨痛失去你
也许分开不容易
也许相亲相爱不可以
痛苦痛悲痛心痛恨痛失自己
情深缘浅不得意
你我也知道去珍惜
只好等在来生里
再踏上彼此故事的开始
生生世世
在无穷无尽的梦里
偶而翻起了日记
翻起了你我之间的故事
一段一段的回忆
回忆已经没有意义
痛苦痛悲痛心痛恨痛失去你
也许分开不容易
也许相亲相爱不可以
痛苦痛悲痛心痛恨痛失自己 oh
情深缘浅不得意
你我也知道去珍惜
只好等在来生里
再踏上彼此故事的开始
生生世世
在无穷无尽的梦里
偶而翻起了日记
翻起了你我之间的故事
一段一段的回忆
回忆已经没有意义
痛苦痛悲痛心痛恨痛失去你
也许分开不容易
也许相亲相爱不可以
痛苦痛悲痛心痛恨痛失自己 oh
情深缘浅不得意
你我也知道去珍惜
只好等在来生里
再踏上彼此故事的开始
只好等在来生里
再踏上彼此故事的开始

3. 恭喜发财

我恭喜你发财
我恭喜你精彩
最好的请过来
不好的请走开
礼多人不怪
我祝
满天下的女孩
嫁一个好男孩
俩小口永远在一块
我祝
满天下的小孩
聪明胜过秀才
智商充满你脑袋
我祝
尊敬的姑奶奶
三十六圈的比赛
气不喘面容不改
我祝
三叔公的买卖
生意扬名四海
财运亨通住豪宅
大摇大摆
乐天替你消灾
恭喜发财
要喊得够豪迈
恭喜发财
我恭喜你发财
我恭喜你精彩
最好的请过来
不好的请走开
礼多人不怪
我祝
大家笑口常开
用心把爱去灌溉
明天呀我们更厉害
我祝
在世界的舞台
跑得比那黑人更快
岁岁年年出人才
大摇大摆
乐天替你消灾
恭喜发财
要喊得够豪迈
我恭喜你发财
我恭喜你精彩
最好的请过来
不好的请走开
礼多人不怪
我恭喜你发财
我恭喜你精彩
最好的请过来
不好的请走开
礼多人不怪
恭喜发财

4. 爱你一万年

地球自转一次是一天
那是代表多想你一天
真善美的爱恋
没有极限 也没有缺陷
地球公转一次是一年
那是代表多爱你一年
恒久的地平线
和我的心 永不改变
爱你一万年
爱你经得起考验
飞越了时间的局限
拉近地域的平面
紧紧的相连
地球公转一次是一年
那是代表多爱你一年
恒久的地平线
和我的心 永不改变
爱你一万年
爱你经得起考验
飞越了时间的局限
拉近地域的平面
紧紧的相连
有了你的出现
有了你的出现
占据了一切我的视线
爱你一万年
爱你经得起考验
飞越了时间的局限
拉近地域的平面
紧紧相连
爱你一万年
爱你经得起考验
飞越了时间的局限
拉近地域的平面
紧紧的相连
我爱你一万年

5. 忘情水

曾经年少爱追梦
一心只想往前飞
行遍千山和万水
一路走来不能回
蓦然回首情已远
身不由己在天边
才明白爱恨情仇
最伤最痛是后悔
如果你不曾心碎
你不会懂得我伤悲
当我眼中有泪
别问我是为谁
就让我忘了这一切
啊给我一杯忘情水
换我一夜不流泪
所有真心真意
任它雨打风吹
付出的爱收不回
给我一杯忘情水
换我一生不伤悲
就算我会喝醉
就算我会心碎
不会看见我流泪
曾经年少爱追梦
一心只想往前飞
行遍千山和万水
一路走来不能回
蓦然回首情已远
身不由己在天边
才明白爱恨情仇
最伤最痛是后悔
如果你不曾心碎
你不会懂得我伤悲
当我眼中有泪
别问我是为谁
就让我忘了这一切
啊给我一杯忘情水
换我一夜不流泪
所有真心真意
任它雨打风吹
付出的爱收不回
给我一杯忘情水
换我一生不伤悲
就算我会喝醉
就算我会心碎
不会看见我流泪
啊给我一杯忘情水
换我一夜不流泪
所有真心真意
任它雨打风吹
付出的爱收不回
给我一杯忘情水
换我一生不伤悲
就算我会喝醉
就算我会心碎
不会看见我流泪
就算我会喝醉
就算我会心碎
不会看见我流泪

解决ubuntu20.*在笔记本电脑上休眠耗电问题,并起不来的问题

linux suspend mode

    linux 有多种suspend模式,其中这里需要关注的是S3(suspend-to-ram)和S4(suspend-to-disk)模式,S3模式下仅有ram保持供电,恢复速度较快,而S4模式下会在休眠时将ram dump到磁盘中(放在专门的swap分区或者swap文件中),休眠期间基本不消耗电力,唤醒时再从磁盘中将ram内容恢复出来,此时唤醒速度会慢于S3,具体时间取决于ram大小和ram与disk之间的传输性能。

一般情况下S3模式已经足够,但希望较为彻底改善休眠续航的问题,则还是需要使用S4模式,即hibernate mode

1. 确认S3模式可用
1
2
3
4
5
6
7
8
9
$ sudo apt install pm-utils

$ pm-is-supported --suspend

$ echo $?

0 # 如果结果是0,则表示支持.

$ sudo pm-suspend # 直接进入S3休眠模式
2. 确认S4模式可用
1
2
3
4
5
$ sudo apt install pm-utils
$ pm-issupported --hibernate
$ echo $?
# 如果结是果是0,则表示支持
$ sudo pm-hibernate # 直接进入S4待机模式

如果可以成功进入S4模式,则笔记本会自动息屏,同时按下电源键可以唤醒, 如果不能够成功休眠,使用

1
$ sudo dmesg | grep PM

应该可以查看是否进入hibernate 成功或者失败,如果显示fail,则需要使能S4模式

3. 使能S4待机模式

    S4模式需要swap partition或者swap file的支持,目前新的ubuntu版本默认都是使用swap file,位于/swapfile, S4模式需要swapfile的大小不小于ram大小。

通过设置swapfile来使能S4模式,请看[通过设置swaptfile来使能hibernamte模式](Hibernate and resume from a swap file - Ask Ubuntu)

完成后,再进行

1
$ sudo pm-hibernate # 进入hibernate验证。这时要按电源键开机。

    如果成功了则

1
$ seervice systemd-hibernate start

streamlit学习笔记五-----多个小部件分组

默认情况下,每次用户与您的streamlit应用(表单)交互时,Streamlit 都会重新运行您的脚本。然而,有时在实际重新运行脚本之前等待一组相关的小部件(表单项)被填充完后,再执行更好,这里st.form()诞生了。

格式

st.form(key: str, clear_on_submit: bool = False)
key: 字符串,表示这个表单的标识
clear_on_submit:布而值,如果为 True,则在用户按下提交按钮后,表单内的所有小部件都将重置为其默认值。

一 with用法
1
2
3
4
5
6
7
8
9
10
11
12
with st.form("my_form"):
st.write("Inside the form")
slider_val = st.slider("Form slider")
checkbox_val = st.checkbox("Form checkbox")

# 每一个form必须有一个 submit 按钮.
submitted = st.form_submit_button("Submit")
if submitted:
st.write("slider", slider_val, "checkbox", checkbox_val)

st.write("己通退了表单j")

二 指名用法
1
2
3
4
5
6
7
8

form23 = st.form("my_form")
form23.slider("Inside the form")
st.slider("在此表单外面了")

# 增加一个submit按钮到此表单:
form23.form_submit_button("Submit")

flask打开Excel文件,并传给luckysheet显示

flask是个很好的网站框架,luckysheet的是一个很好的采用JS编写的表格框架,由于我一直采用flask,没有学习过javascript,所以想利用方便的lucksheet,如何结合呢?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#coding:utf8
from flask import Flask
from flask import request,render_template
import pandas as pd
import numpy as np
# from werkzeug import secure_filename
import os

app=Flask(__name__)

# 以下函数把一个excel表格读出,然后把数据转换成luckysheet的celldata,以便采用luckysheet显示在网页上
def pands_to_luckysheet(file_name):
sheet_data=[] # 定义一个空列表

data_f = pd.read_excel(file_name)

none_nan=(data_f.isnull()) | (data_f.apply(lambda x: str(x).isspace())) # 找到所有的None
data_f=data_f[~none_nan] # 把所有的None替换为nan
# print("data_f2=",data_f)
data_f=data_f.fillna("") # 把所有的nan替换为空字符
# print("data_f3=",data_f)
row=len(data_f) # 行数
col=len(data_f.columns) #列数
# 打算把数据转换为luckysheet的celldata数据
for i in range(row):
for j in range(col):
# sheet_data[k]=[{"r":i,"c":j,"v":{"v":data_f.iloc[i,j]}}]
# k=k+1
sheet_data.append({"r":i,"c":j,"v":{"v":data_f.iloc[i,j],"m":data_f.iloc[i,j]}}) # 添加列表项
return sheet_data
# print("测试luckckyshee数据转换")
# print(sheet_data)

@app.route("/table_channel")
def table_channel():
sheet_data=pands_to_luckysheet("/home/mywork/2021/汇总.xlsx")
# print("sheet_data=",sheet_data)
return render_template("index.html" ,lucky_data=sheet_data)

streamlit学习笔记四-----暂称为组件吧

创建静态组件

如果您创建 Streamlit 组件的目标仅仅是显示 HTML 代码或从 Python 可视化库中呈现图表,Streamlit 提供了两种方法来极大地简化流程:components.html() 和 components.iframe()。

  1. 渲染一个 HTML 字符串用:

    1
    streamlit.components.v1.html(html, width=None, height=None, scrolling=False)

    html (str) – 要嵌入 iframe 的 HTML 字符串。注意是字符串,如果是文件名,则会出错

width (int) – 以 CSS 像素为单位的框架宽度。 默认为报告的默认元素宽度。

height (int) – 以 CSS 像素为单位的框架高度。 默认为 150。

scrolling (bool) – 如果为 True,则在内容大于 iframe 时显示滚动条。 否则,不显示滚动条。 默认为假。
例子:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import streamlit as st
import streamlit.components.v1 as components

# bootstrap 4 collapse example

html_data= """
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<div id="accordion">
<div class="card">
<div class="card-header" id="headingOne">
<h5 class="mb-0">
<button class="btn btn-link" data-toggle="collapse" data-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
Collapsible Group Item #1
</button>
</h5>
</div>
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
<div class="card-body">
Collapsible Group Item #1 content
</div>
</div>
</div>
<div class="card">
<div class="card-header" id="headingTwo">
<h5 class="mb-0">
<button class="btn btn-link collapsed" data-toggle="collapse" data-target="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
Collapsible Group Item #2
</button>
</h5>
</div>
<div id="collapseTwo" class="collapse" aria-labelledby="headingTwo" data-parent="#accordion">
<div class="card-body">
Collapsible Group Item #2 content
</div>
</div>
</div>
</div>
"""
components.html(html_data, width=None, height=300,scrolling=False)
)
  1. 呈现 iframe URL用用:

    1
    streamlit.components.v1.iframe(src, width=None, height=None, scrolling=False)

    参数
    src (str) – 要嵌入的页面的 URL。

width (int) – 以 CSS 像素为单位的框架宽度。 默认为报告的默认元素宽度。

height (int) – 以 CSS 像素为单位的框架高度。 默认为 150。

scrolling (bool) – 如果为 True,则在内容大于 iframe 时显示滚动条。 否则,不显示滚动条。 默认为假。
例子:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import streamlit as st
import pandas as pd
import numpy as np
import streamlit.components.v1 as components

st.set_page_config( page_title="Streamlit 练习 ", layout="wide" )

page_html_luckysheet = """
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<div id="accordion">
<div class="card">
<div class="card-header" id="headingOne">
<h5 class="mb-0">
<button class="btn btn-link" data-toggle="collapse" data-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
Collapsible Group Item #1
</button>
</h5>
</div>
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
<div class="card-body">
Collapsible Group Item #1 content
</div>
</div>
</div>
<div class="card">
<div class="card-header" id="headingTwo">
<h5 class="mb-0">
<button class="btn btn-link collapsed" data-toggle="collapse" data-target="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
Collapsible Group Item #2
</button>
</h5>
</div>
<div id="collapseTwo" class="collapse" aria-labelledby="headingTwo" data-parent="#accordion">
<div class="card-body">
Collapsible Group Item #2 content
</div>
</div>
</div>
</div>
"""
# st.markdown( page_html_head, unsafe_allow_html=True)
container_top = st.container()
container_body = st.container()

# Top
with container_top:
st.markdown(" [新浪网](https://www.sina.com.cn) /[我的笔记](https://superigbt_superigbt.gitee.io) ")
st.image("/home/frankli/temp/建站/banner/mybanner4-1.jpg",caption='my banner', use_column_width=True)


# Body
with container_body:
# components.iframe( "https://superigbt_superigbt.gitee.io/")
left_side, right_side = st.columns([1,6])
# 左边,注意with语句的下一行缩进
with left_side:
left_side.subheader(" 左边的窄列,预留菜单树 ")
# 右边,注意缩进。
with right_side:
components.html( page_html_luckysheet )
components.iframe("https://superigbt_superigbt.gitee.io",width=None, height=600, scrolling=True)

streamlit学习笔记三-----layout

streamlit的页面能不能像写html一样的进行页面布局呢?不会css的程序员咋整呢? 有以下方法

一. 自动左右排版

我们在streamlit的演示时,streamlit hello就能看到。己经是左右分两列的布局了。这个不用做专门布局,只要在代码中加入sidebar就行。比如要把一个markdown写入左侧栏只要
把st.markdown(xxx)改为st.sidebar.markdown(xxx)就行。

二. streamlit代码形式。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
""" 
## 一 streamlit.beta_container()
通过with st.beta_container():,可以Book一个组件模块
将一个不可见的容器插入到你的应用程序中,可以用来保存多个元素。
"""

st.markdown(" - with写法 ")
with st.beta_container():
st.write("with写法,此句放在这个没有命名的容器中,注意通过缩进来表示范围")
# You can call any Streamlit command, including custom components:
st.bar_chart(np.random.randn(50, 3))

st.write("此句放在没有命名的容器外")

st.markdown(" - 常规写法 ")
container_one = st.beta_container()
container_one.write(" 此句写在一个名叫container_one的容器内 ")
st.write(" 没有加容器前缀,所以就只写在容器外了 ")

st.markdown(" - 在另外的地方给一个容器内插一句话 ")
container_one.write("要想在另外的地方给容器内插一句话,容器必须命名,当然这个不符合程序规则,程序结构一塌糊涂 ")

st.markdown(" --- ")
#-------------------------------------------------------------------------------------------------------------
"""
## 二 分列展示
streamlit.beta_columns(spec)

以并排列的形式插入容器。插入多个并排放置的多元素容器,并返回容器对象列表。

要向返回的容器添加元素,可以使用“with”表示法(首选),或者直接调用返回对象的方法。

"""
st.subheader(" 请参见下面的例子。")

col1, col2, col3 = st.beta_columns(3)

with col1:
st.header("猫头")
st.image("/home/frankli/Pictures/cat.jpg", use_column_width=True)

with col2:
st.header("侧滑手机")
st.image("/home/frankli/Pictures/cehua3.jpeg", use_column_width=True)

with col3:
st.header("金色庄园")
st.image("/home/frankli/Pictures/金色庄园.jpg", use_column_width=True)

st.markdown(" --- ")
#-------------------------------------------------------------------------------------------------------------
"""
## 三 按照比例分列展示
"""

col1, col2 = st.beta_columns([3, 1])
data = np.random.randn(10, 1)

col1.subheader(" 宽列展示图表 ")
col1.line_chart(data)

col2.subheader(" 窄列展示数据 ")
col2.write(data)

st.markdown(" --- ")
#-------------------------------------------------------------------------------------------------------------
"""
## 4 折叠/展开
streamlit.beta_expander(label=None, expanded=False)
"""


with st.beta_expander("See explanation"):
st.write("""
在这里进行折叠与展开。
""")
st.line_chart({"data": [1, 5, 2, 6, 2, 1]})