Skip to content

Instantly share code, notes, and snippets.

@leoricklin
Last active February 16, 2024 08:55
Show Gist options
  • Save leoricklin/ddab3379c8bc3ed7e7fdd7ae986d8b8c to your computer and use it in GitHub Desktop.
Save leoricklin/ddab3379c8bc3ed7e7fdd7ae986d8b8c to your computer and use it in GitHub Desktop.

Application

Apache Ant & Maven

Resources

Chrome

F12 DevTool -> [Network] -> Img

mermaid diagram

Draw.io

  • app.diagrams.net

Hand-drawn style online diagram tool

Evernote

operator Description
intitle:
notebook:
any:
tag: tag:"My.TOREAD.★" tag:"BA.AI"
-tag:
created:
updated:
resource:
latitude:
longitude:
altitude:
source:
todo:
encryption:

Notepas++

  • Config

    • Tab size: Setting -> Preference -> Language -> Tab setting
  • Regex "\s*\.*\s\d*$"

Text

Special chars

,、;:。?!「」『』◎☆★△▲▽▼○●◇◆□■←→↑↓°C ∑ + - ± × ÷ ≤ ≥ ≈ √  ∫  ∩ ∪ ∈
Greek Letter : α β γ ε ζ η θ λ μ ν π σ χ ω
1 2 3 4 5 6 7 8 9 0
! @ # $ % ^ & * ( )

Confluence

Label

  • Add, Remove and Search for Labels, https://confluence.atlassian.com/doc/add-remove-and-search-for-labels-136419.html

    Search by label

    You can use the labelText: prefix to search specifically for content that has a specific label. For example, if you're looking for pages with the label 'chocolate', type labelText:chocolate into the search field in the Confluence header. For more examples of searching by label, see Confluence Search Syntax.

Firefox

  • ctrl + I : Page Info

JIRA

Story

A story (or user story) is a feature or requirement from the user’s perspective. Stories should be defined using non-technical language so anyone involved in the project can understand. For example:

Example: As a player, I want to use a joystick to control my character (or “Add joystick support”) The player is the user of the game, and in this story, the support for an input device is required. To solve this issue, it may be necessary to assign several smaller work items to individual teammates as subtasks.

Task

Tasks are work items that are not directly related to a user requirement but still must be completed, like the upgrading of a server, the coding of a function, or even the ordering of a pizza for the team. A task contains a more detailed and technical description of the particular work item.

Example: Reduce latency to improve character movement

In this case the task involves updating a core function of the game rather than a user feature. While tasks can generally be completed by one team member, they may also be broken down into individually manageable subtasks.

Bug

O, the lamented bug. By classifying bugs as their own issue type, we can differentiate the work they require from other issues. This enables the team do things like filter by bugs in the backlog or draft reports on the number of bugs fixed per week.

Example: Character sometimes moves backward when pushing the joystick forward

Subtask

A subtask is the child of another issue, and is used to break down stories, tasks, or bugs into individually manageable pieces of work. Since they are written for the person working on the task, subtasks can be more technical than their parent issues.

In the above story of adding support for an input device, the following subtasks may be completed by different team members:

Example:

  • [Game Designer] Map game mechanics to joystick inputs
  • [Software Engineer] Implement input mapping for character movement
  • [Artist] Create a visual for joystick configuration in the options menu

A subtask can only be created under a parent issue. However, each subtask has its own issue key and can be moved through boards independently.

Epic

Finally, an epic is a parent issue that groups stories, tasks, and bugs together to capture a large, holistic body of work. As the name implies, epics usually represent a significant deliverable. In the backlog, you can filter by issues belonging to a single epic.

Example: Character movement update

In this example, the epic encompasses the story of adding joystick support, as well other stories, tasks, and bugs in an overall initiative. It might look something like this:

  • Epic: Character movement update
    • Story: As a player, I want to use a joystick to control my character.
      • Subtask: [Game Designer] Map game mechanics to joystick inputs
      • Subtask: [Software Engineer] Implement input mapping for character movement
      • Subtask: [Artist] Create a visual for joystick configuration in the options menu
    • Task: Reduce latency to improve character movement
      • Subtask: [Software Engineer] Reduce server calls and move processing to client side
      • Subtask: [IT] Update SDK for engineering team
    • Bug: Character sometimes moves backward when pushing the joystick forward
      • Subtask: [Testing] Determine conditions where this behavior happen

Markdown

Syntax

<style>
body { background-color:blue; }
.highlightme { background-color:#FFFF00; }
p { background-color:#FFFFFF; }

</style>
<span style="font-family: monospace;white-space:pre;"> 
class DieLayoutExtractor:
  def __init__(self, spark: SparkSession, kerberos_principal: str, kerberos_keytab: str, fab: str):
    <mark>self.pl = mu_productlayout.ProductLayout(self.hbc)</mark>

  def extract(self, did: str, ctrx: int = None, ctry: int = None):
    return self.extract_die_layout_pyspark(did, ctrx=ctrx, ctry=ctry)
</span>
<span style="color:red;font-family: monospace"> abcde </span>
<span style="background-color:lightyellow"> X </span>
<span class="highlightme"> X </span>
<mark> X </mark>
  • Horizontal line

---
  • Image
<img src="https://raw.githubusercontent.com/leoricklin/gist_resources/main/c4model/c4model.png" style="display:block;margin-left:0;height:800px;"/>
<img src="https://i1.wp.com/a16z.com/wp-content/uploads/2020/10/Data-Report-Martin-Inline-Graphics-R7-06-1.jpg" style="display:block;margin-left:0;height:800px;"/>
![Image]()
  • Table
<table style="border:5px">

<tr>
<th>Name</th>
<th>Size</th>
</tr>

<tr>
<td></td>
<td></td>
</tr>

</table>
1 | 2 | 3
---|---|---
cell 1 | <br/> 21 <br/> 22 <br/> 23 | <ul><li>31</li><li>32</li></ul>
1 2 3
cell 1
21
22
23
  • 31
  • 32
  • Comment
[//]: # "###################################"
# Markdown
[//]: # "###################################"

[//]: # "####################"
###
[//]: # "####################"

[//]: # "#####"
##### Markdown
[//]: # "#####"
  • CTRL+ F will search chats and channels now too.

screen

參數 說明
-c file 使定使用的設定檔(預設為 $HOME/.screenrc)
-d [pid.tty.host] 強制將指定的 screen 工作環境卸離
-L 開啟自動紀錄功能
-ls 或 -list 列出目前所有執行中的 screen 工作環境
-r [pid.tty.host] 重新連接執行中的 screen 工作環境
-R 重新連接最近卸離的 screen 工作環境
-S session_name create a named session
-U 以 UTF-8 模式執行
-wipe [match] 將廢棄的 screen 工作環境清除
screen 操作指令表 說明
Ctrl + a 與 Esc鍵(或 Ctrl + a 與 [) 進入複製模式(copy mode),可用方向鍵操作捲軸,或用 / 與 ? 來搜尋,按下空白鍵開始選取要複製的內容,選取完成後再按下第二次空白鍵,即可複製,隨後使用 Ctrl + ] 可貼上複製的內容。
Ctrl + a 與 Ctrl + a 切換至上一個 screen 視窗
Ctrl + a 與 Ctrl + g 視覺化鈴聲(visual bell)切換
Ctrl + a 與 Tab鍵 切換分割畫面
Ctrl + a 與 ? 顯示說明
Ctrl + a 與數字鍵 0 到 9 切換至指定編號的 screen 視窗
Ctrl + a 與 " 列出目前所有的 screen 視窗,並可用上下鍵選擇要切換的設窗
Ctrl + a 與 a 送出 Ctrl + a
Ctrl + a 與 c 建立新 screen 視窗
Ctrl + a、D 與 D 強力卸離,卸離 screen 工作環境之後,直接登出
Ctrl + a 與 n 切換至下一個的 screen 視窗
Ctrl + a 與 p 切換至下一個的 screen 視窗
Ctrl + a 與 w 列出目前所有的 screen 視窗
Ctrl + a 與 k 關閉目前的 screen 視窗
Ctrl + a 與 d 卸離 screen 工作環境
Ctrl + a 與 S 將畫面分割成上下兩個區域
Ctrl + a 與 Q 關閉分割畫面
Ctrl + a 與 t 顯示目前系統的時間與負載狀況
Ctrl + a 與 v 顯示版本資訊
Ctrl + a 與 x 鎖定 screen 螢幕
Ctrl + a 與 H 開啟或結束 screen 紀錄功能
Ctrl + a 與 C 清除 screen 視窗中的內容
Ctrl + a 與 i 顯示目前 screen 視窗的資訊
Ctrl + a 與 l 重繪目前 screen 視窗的內容
$ sudo screen -S mcs java -Xmx1024M -Xms1024M -jar server.jar nogui
$ screen -r mcs -X stuff '/save-all\n/save-off\n'

Config

Ubuntu

apt

% sudo vi /etc/apt/apt.conf.d/proxy.conf
Acquire::http::Proxy "http://XXX.com:80";
Acquire::https::Proxy "http://XXX.com:80";

% sudo sh -c "echo 'Acquire::http::Proxy \"http://XXX.com:80\";' > /etc/apt/apt.conf.d/proxy.conf"
% sudo sh -c "echo 'Acquire::https::Proxy \"http://XXX.com:80\";' >> /etc/apt/apt.conf.d/proxy.conf"

Unix Commands & Utilities

bash

sh 1.sh >> 1.log 2>&1
  • array
$ for i in 1 2 3; do echo $i; done
1
2
3

$ dtlist=(1 2 3); for i in ${dtlist[*]}; do echo $i; done
1
2
3

$ echo ${dtlist[1]} # zero-based
2


$ AAA="Proprietary"; echo ${AAA:1:3}
rop

  • read per line
$ DT="2018090316"; \
  TARF="rsyslog-${DT}"; \
  while read line
  do /usr/bin/logger –p local7.info ${line};
  done < ${TARF}

awk

% head -n 3 simple_dbt_project/raw_data/customer.csv
customer_id,zipcode,city,state_code,datetime_created,datetime_updated
1,14409,franca,SP,2017-10-18 00:00:00,2017-10-18 00:00:00
2,09790,sao bernardo do campo,SP,2017-10-18 00:00:00,2017-10-18 00:00:00

% awk '{FS=","; if ($1==82) {print}}' simple_dbt_project/raw_data/customer.csv
82,59655,areia branca,RN,2017-10-18 00:00:00,2017-10-18 00:00:00

date

$ echo $(date -d  "2016-02-01 -5 days" '+%Y-%m-%d')
2016-01-27

% echo $(date '+%Y%m%d%H%M%S')
20211004032114

find

find . -name ".ipynb*"  -exec rm -r {} \;

grep

df|grep -E 'A|B'

netstat

netstat -plunt

sar

tree

% sudo apt install tree
% tree

├── build_docker.md
├── Dockerfile
├── install_docker.md
├── README.md
└── requirements.txt

UUID

$ uuid=`od -x /dev/urandom | head -1 | awk '{OFS="-"; print $2$3,$4,$5,$6,$7$8$9}' | tr a-z A-Z`; echo ${uuid}
5A891705-08C1-40B4-3F4F-3B5EB4889BAC

vim

  • to turn off autoindent when you paste code,
:set paste
  • position
jump 1st char jump to last char
1 $
goto n-line -
:<n>g -
  • delete
delete all words after cursor -
:dG -

Virtualization

Virtual Box

Guide

  • Install Guest Addition

    • VM -> Setup -> Storage -> IDE -> CDROM, path: C:\Program Files\Oracle\VirtualBox\VBoxGuestAdditions.iso, Live: enable
    • Login guest VM
      sudo mkdir -p /media/cdrom; sudo mount /dev/cdrom /media/cdrom;
      cd /dev/cdrom /media/cdrom; sudo ./VBoxLinuxAdditions.run
      sudo shutdown -r now
      
  • Shared Folder

    • VM -> Setup -> Shared Folders -> Add -> Folder path, Mount point, Make Permanent: Enable
    • Login guest VM:
      sudo adduser $USER vboxsf
      
      or
      sudo usermod --append --groups vboxsf $USER
      
  • Setup NAT Port Forwarding

    • VM -> Setup -> Network -> Attached: NAT, Advanced -> Prot Forwarding
Name Protocol Host IP Host Port Guest IP Guest Port
Rule1 (SSH) TCP 31022 22
Rule2 (Jupyter) TCP 8890 8890
Rule3 (dbt doc server) TCP 9000 9000
% ssh -l username -p 31022 localhost

Resources

VS Code

  • alt + shift + F : format document

  • Ctrl + X Cut line (empty selection)

  • Ctrl + C Copy line (empty selection)

  • Alt + ↑ / ↓ Move line up/down

  • Shift + Alt + ↓ / ↑ Copy line up/down

  • Ctrl + Shift + K Delete line

  • Ctrl + Enter Insert line below

  • Ctrl + Shift + Enter Insert line above

  • Ctrl + Shift + \ Jump to matching bracket

  • Ctrl + ] / [ Indent/outdent line

  • Home / End Go to beginning/end of line

  • Ctrl + Home Go to beginning of file

  • Ctrl + End Go to end of file

  • Ctrl + ↑ / ↓ Scroll line up/down

  • Alt + PgUp / PgDn Scroll page up/down

  • Ctrl + Shift + [ Fold (collapse) region

  • Ctrl + Shift + ] Unfold (uncollapse) region

  • Ctrl + K Ctrl + [ Fold (collapse) all subregions

  • Ctrl + K Ctrl + ] Unfold (uncollapse) all subregions

  • Ctrl + K Ctrl + 0 Fold (collapse) all regions

  • Ctrl + K Ctrl + J Unfold (uncollapse) all regions

  • Ctrl + K Ctrl + C Add line comment

  • Ctrl + K Ctrl + U Remove line comment

  • Ctrl + / Toggle line comment

  • Shift + Alt + A Toggle block comment

  • Alt + Z Toggle word wrap

share your public key with your trusted hosts.
  • in remote host, run echo '<public key of your vs code machine>' >> ~/.ssh/authorized_keys

Windows

WIN + SHIFT + S : Snip screen

env vars

Win 10 Windows menu -> Windows System -> Control Panel -> System & Security -> System (Memory, Remote Access) -> Right-hand panel: Advanced System Setting

Multiple Clipboard, Setting -> System -> Clipboard -> Multiple item

WIN + V

prevent preview of Edge tab

設定 -> 系統 -> 多工 -> alt+tab: only Edge window

Zoom, Setting -> Easy Access -> Magnifier

Ctrl + Alt + Mouse Scroll Up/Down WIN + +/-

Windows Firewall

wf.msc

schtasks /create /sc minute /mo 30 /tn CheckNetwork /tr d:\chknet.bat
schtasks /query
schtasks /delete /tn CheckNetwork 
sfc /scannow
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment