Use markdown as PPT with Marp

這裡記錄一下如何使用Marp. Installation 到marp-cli release page下載 binary.放在想要的Path中. 執行marp確認是否可以執行 Usage 將md file匯出成html 1 marp <md file> 在資料夾中開啟server mode 1 marp -s -I <directory> Marpit Configuration Reference 在新創的md中開頭有些可設定參數,這裡就列出自己可能常用的參數 1 2 3 4 5 6 7 --- marp: ture paginate: true theme: uncover class: invert --- 也可在單頁設定.例如不想要在首頁顯示頁碼,則在首頁標題前加入 <!-- _paginate: false --> 換頁時記得加入---

February 27, 2023 · 1 min · 48 words · Wesley Chen

Leetcode 5: Longest Palindromic Substring

Given a string s, return the longest palindromic substring in s. Example 1: 1 2 3 Input: s = "babad" Output: "bab" Explanation: "aba" is also a valid answer. Example 2: 1 2 Input: s = "cbbd" Output: "bb" Constraints: 1 <= s.length <= 1000 s consist of only digits and English letters. Solution 因為要找最大迴文子字串,而迴文字串前後讀法都一樣,意即可以將題目理解為若字串 s="babad 而將字串倒至則 reverse(s)="dabab,找到這兩個字串最大相同子字串,並且 要再正確的位置(相對倒至相同之位置). Step 1. 如何找最大相同子字串? if len(s1) = len(s2) 將s1, s2組成二維矩陣 比對矩陣對應字母是否相等 找到最長標記相同對角線即為最大相同子字串 若 s1="acbcbcef", s2="abcbced", 則矩陣...

February 6, 2023 · 3 min · 610 words · Wesley Chen

WSL Matplotlib Plot GUI

TL;DR Install VcXsrv. Install PyQT Add following to shellrc 1 export DISPLAY=`grep -oP "(?<=nameserver ).+" /etc/resolv.conf`:0.0 Open win firewall by: Windows Security -> Firewall & network protection -> Allow an app through firewall -> make sure VcXsrv has both public and private checked. (When Launching xlaunch first time, you might get a prompt to allow through firewall. Launch XLaunch with “Disable access control” ticked Reference Show matplotlib plots (and other GUI) in Ubuntu (WSL1 & WSL2)

October 19, 2021 · 1 min · 76 words · Wesley Chen

npm global installed path config

In order to fix Error: EACCES: permission denied, access '/usr/lib/node_modules', a solution will be set installed path non-root. Here’s how to set it. 1 2 mkdir ~/.npm-global npm config set prefix '~/.npm-global' This can see if config set properly 1 npm config list Output will be like this 1 2 3 4 5 6 7 8 9 10 11 12 ; cli configs metrics-registry = "https://registry.npmjs.org/" scope = "" user-agent = "npm/6....

October 18, 2021 · 1 min · 122 words · Wesley Chen

Name Export vs Default Export

Name Export Export 1 2 3 4 5 6 7 export const Hello = () => { return <h1>Hello</h1>; } export const Goodbye = () => { return <h1>Goodbye</h1>; } We can export multiple components from a single file. Import 1 2 3 4 import { Hello, Goodbye } from "./Greetings" // or import * as Greetings from "./Greetings" <Greetings.Hello /> Default Export Export 1 2 3 4 5 const Hello = () => { return <h1>Hello</h1>; } export default Hello; only export one component per file;...

October 15, 2021 · 1 min · 184 words · Wesley Chen

SSH X server on Windows

Installation Install VcXsrv 1 scoop install vcxsrv Setup xLauncher 1 xlaunch.exe config.launch 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 <?xml version="1.0" encoding="UTF-8"?> <XLaunch WindowMode="MultiWindow" ClientMode="NoClient" LocalClient="False" Display="-1" LocalProgram="xcalc" RemoteProgram="xterm" RemotePassword="" PrivateKey="" RemoteHost="" RemoteUser="" XDMCPHost="" XDMCPBroadcast="False" XDMCPIndirect="False" Clipboard="True" ClipboardPrimary="True" ExtraParams="-ac -nowgl" Wgl="True" DisableAC="False" XDMCPTerminate="False" /> Add env variable to PowerShell PROFILE 1 2 # vi $PROFILE, and add below line $env:DISPLAY='localhost:0....

October 14, 2021 · 1 min · 85 words · Wesley Chen

My Bash/Zsh-like PowerShell Journey

TL;DR This is a note that I found out Microsoft PowerShell can act like Bash/Zsh which I much familiar with. Because of the work, pretty much whole operating system move to windows. It is so much pain to work without using any shell. The main reason is that I so much used to use (neo)vim as my code editor. But luckily (neo)vim built for windows (phew~). Ok, back to the title, this is a step by step note that I dig into PowerShell and Windows....

October 13, 2021 · 2 min · 308 words · Wesley Chen

ReactJs Learning Note

React is component-based Create react component class. Use ReactDOM.render() refresh html ReactDOM.render(element, container[, callback]) JSX component lifecycle

October 13, 2021 · 1 min · 17 words · Wesley Chen

JavaScript Learning Note

JavaScript Note 5 type Undefined Null String Boolen Number Others r Object 3 way create Object Object literal 1 var a = { name:'Wesley', score: 100 }; new operator 1 var a = new Date Constructor function 1 2 3 4 5 function Student(name, score){ this.name = name this.score = score } var a = new Student('Wesley', 100); Primitive variable assignment makes a “copy” Object variable assignment pass the “reference” Function can be anonymous // recommended 1 var add = function(a, b) { return a + b; }; Return a function 1 2 3 4 5 6 7 var f = function(s) { return s?...

October 12, 2021 · 5 min · 887 words · Wesley Chen