2020年12月9日 星期三

關於磨合

關於磨合

這篇文章寫得挺有道理,在此引用一下。

當你意識到對方提出測試了,你根本不用想著通過,因為若你本來就是她要的,那你的真實本質將不證自明,若你不是她要的,那大家合則來,不合則散。

這次的事情之所以會不順利,追根究柢應該是有文章中的心態。為了一個結果而硬是去迎合,忽略了太多事情,希望日後能有所改善。

2020年9月17日 星期四

climb 5.12a

climb 5.12a

原文

感覺很值得參考,目前往11a邁進

擷取General Guidelines段落
Climb

  • Establish a weekly training schedule and stick to it.
    建立每週訓練計畫,並好好執行它

  • Climb 2 to 4 days/week; never more than 2 days in a row.
    每週爬兩到四天,「連續爬」的次數不超過兩次(例如:一、二、四、六)

  • Warm up with light aerobic exercise, dynamic stretching, and easy climbing.
    用輕量級有氧、動態伸展還有簡單的路線熱身

  • Take at least 1 day of total rest each week.
    一週完整休息一次

  • Focus on holds, angles, and moves encountered in Ten Sleep; use your route’s beta to guide training route setting.
    針對目標路線進行研究(這裡的Ten Sleep是一條5.12a的路線)

  • Spend 1 or 2 first-days-on (your first day climbing after a rest) bouldering each week.
    完整休息的第一天,進行抱石訓練

  • Incorporate 4x4 power-endurance training 1x/week. Climb 4 12- to 20-move boulder problems 4 times each, with 1 to 5 minutes of rest between each problem.
    每週進行一次4x4力量耐力訓練,爬12-20個點的抱石路線四條,每條路線爬4次,中間休息1-5分鐘。

  • Incorporate high-intensity endurance training 1x to 2x/ week. Climb 3 to 7 routes with 20 to 25 pumpy moves to a resting hold. Shake out and recover, then climb for another 15 to 20 moves.
    每週進行一到兩次高強度的耐力訓練,攀登3-7條20-25個點的長路線,在牆上休息後一下,再繼續爬(岩館上下攀數次應賅算)

Strength

  • Weight train 2x/week right after climbing or the day after; don’t climb to exhaustion and then weight train.
    在攀岩後或隔天進行重量訓練,每週兩次,盡可能避免爬到力竭

  • Rest 2 days between each weight session.
    重量訓練間休息兩天

  • Day 1: Pull-ups/lat pull-downs; tricep push-downs/dips; rows; wrist curls; reverse wrist curls.
    Day1: 引體向上/背部下拉(訓練背肌) ;下推(訓練三頭肌); 腕部捲曲訓練、反向腕部捲曲訓練(訓練前手臂肌肉)

  • Day 2: Deadlifts; squats; bench presses/push-ups; military presses; captain’s chair leg lifts.
    硬舉(下背部、臀部肌肉);握推/伏地挺身(胸肌);槓鈴上舉;captain’s chair leg lifts(核心)

  • Rest 3 minutes between sets of same exercise.
    組間休息三分鐘

  • Do weighted finger curls 1x to 2x/week. See “Efficient Finger Training” sidebar.
    每週訓練兩次手指強度

  • The last week of each month, do 1 set (lighter reps) of each exercise, and take extra rest days.

2020年5月22日 星期五

陽明大學米卡茲早餐店

炸雞塊特別好吃
店員女兒在椅子上睡得很香很可愛

2020年5月19日 星期二

ssh免密碼登入

ssh免密碼登入

SSH免密碼登入設定小細節

關於免密碼登入這件事網路上很多教學了,但有時照著做,伺服器仍會跟你要密碼,這是因為有些權限沒有設定好的關係。

根據sshd的man page,這裡有提到一些重點:

 ~/.ssh/
     This directory is the default location for	all user-specific con-
     figuration	and authentication information.	 There is no general
     requirement to keep the entire contents of	this directory secret,
     but the recommended permissions are read/write/execute for	the
     user, and not accessible by others.

 ~/.ssh/authorized_keys
     Lists the public keys (DSA, ECDSA,	Ed25519, RSA) that can be used
     for logging in as this user.  The format of this file is de-
     scribed above.  The content of the	file is	not highly sensitive,
     but the recommended permissions are read/write for	the user, and
     not accessible by others.

     If	this file, the _~/.ssh_ directory, or the	user's home directory
     are writable by other users, then the file	could be modified or
     replaced by unauthorized users.  In this case, **sshd** will not al-
     low it to be used unless the **StrictModes** option has been set to
     "no".

也就是說,ssh相關的目錄要做好以下設定才行:

$HOME/.ssh/ 權限要設定成700
$HOME/.ssh/authorized_keys權限設定成600
$HOME 預設的設定通常正確,但要留意不能讓其他user能寫

如果違背以上限制,還是會被要密碼的~

2020年3月11日 星期三

python tricks

python tricks

Python ticks quick reference

pdb/ipdb

https://docs.python.org/3/library/pdb.html
https://github.com/gotcha/ipdb
pdb

import pdb; pdb.set_trace()

ipdb

import ipdb
ipdb.set_trace()

list comprehension

>> [i for i in range(10) if i != 5]

output

[0, 1, 2, 3, 4, 6, 7, 8, 9]

列出object properties

>> vars(<object>)

f-string

PEP 498

>> a = 1234
>> print(f"a = {a}")
a = 1234

yield - send

asyncio

PEP 492
https://docs.python.org/3/library/asyncio-task.html#coroutines
simple example

async def main():
    task1 = asyncio.create_task(
        say_after(1, 'hello'))

    task2 = asyncio.create_task(
        say_after(2, 'world'))

    print(f"started at {time.strftime('%X')}")

    # Wait until both tasks are completed (should take
    # around 2 seconds.)
    await task1
    await task2

    print(f"finished at {time.strftime('%X')}")

Running Tasks Concurrently

import asyncio

async def factorial(name, number):
    f = 1
    for i in range(2, number + 1):
        print(f"Task {name}: Compute factorial({i})...")
        await asyncio.sleep(1)
        f *= i
    print(f"Task {name}: factorial({number}) = {f}")

async def main():
    # Schedule three calls *concurrently*:
    await asyncio.gather(
        factorial("A", 2),
        factorial("B", 3),
        factorial("C", 4),
    )

asyncio.run(main())

# Expected output:
#
#     Task A: Compute factorial(2)...
#     Task B: Compute factorial(2)...
#     Task C: Compute factorial(2)...
#     Task A: factorial(2) = 2
#     Task B: Compute factorial(3)...
#     Task C: Compute factorial(3)...
#     Task B: factorial(3) = 6
#     Task C: Compute factorial(4)...
#     Task C: factorial(4) = 24

multiprocessing

multithreading

concurrent

Encoding declarations

https://docs.python.org/3.6/reference/lexical_analysis.html#encoding-declarations
Put the follow comment in the first or second line of the Python script:
-*- coding: <encoding-name> -*-

取得環境變數

import os
os.environ.get('X509_USER_PROXY')

min

這是特別的用法

>>> a = [{"test":{"val1":1}, "name":"A"}, {"test":{"val1":2}, "name": "B"}]
>>> min(a, key=lambda k: k["test"]["val1"])
{'test': {'val1': 1}, 'name': 'A'}

zip

>>> list(zip([1, 2, 3], [4, 5, 6]))
[(1, 4), (2, 5), (3, 6)]

enumerate

>>> list(enumerate(a))
[(0, 'a'), (1, 'b'), (2, 'c')]

getattr

>>>class  A(object):
> ... bar = 1 
> ... 
>>> a = A() 
>>> getattr(a, 'bar')
1

用在自動取得attr時可能會很方便