05 2024 档案
摘要:Sometimes it's handy to break long lines into shorter lines. # read moby-dick file for first 250 lines # then fold each line to have max 30 char (-w)
阅读全文
摘要:Calendar cal May 2024 Su Mo Tu We Th Fr Sa 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 # all months cal 2024 #
阅读全文
摘要:grep is a powerful command-line tool used for searching text using patterns. It's widely used for finding specific text within files or output streams
阅读全文
摘要:curl is a powerful command-line tool for transferring data with URL syntax. It supports various protocols including HTTP, HTTPS, FTP, and many others.
阅读全文
摘要:The kill command sends a signal to a process, usually to terminate the process. kill PID This command sends the SIGTERM signal to the process with the
阅读全文
摘要:ps The ps command is used to display information about running processes. This command displays a snapshot of the current processes. Common Options: a
阅读全文
摘要:Error handling in Bash can be managed using exit statuses and traps. Every commands in Bash returns an exit status (0 for success, non-zero for failur
阅读全文
摘要:Functions in Bash allow you to group commands into reusable blocks. This helps make your scripts more modular and easier to manage. function_name() {
阅读全文
摘要:The new cause data property that you can add to a thrown Error can be used to retain access to the original error caught in a promise rejection. const
阅读全文
摘要:If we want to be able to modify the state of a promise from outside the constructor, we can use the Promise.withResolvers method to get access to the
阅读全文
摘要:The new Array.with method gives you an immutable syntax for changing values of an array at a specified index. Sometimes .map will be more efficient. S
阅读全文
摘要:You no longer need to write generator functions to create basic lazy iterator functions. Now, ECMAScript supports iterator helpers that you can call o
阅读全文
摘要:Compse commands with pipe # List all folders and files in current dir % ls -l total 56 -rw-r--r-- 1 zwt staff 51 May 16 22:35 data.txt -rwxr-xr-x 1 zw
阅读全文
摘要:Write to a file >, >> Append content at the beginning of the file. echo whatever > hello.txt echo Hello world >> hello.txt cat hello.txt # whatever #
阅读全文
摘要:While The while loop executes a block of code as long as a specified condition is true. while [ condition ]; do commands done Example: #!/bin/zsh coun
阅读全文
摘要:The "Set Methods" proposal introduces 7 new methods to JavaScript/ECMAScript: union(setB): Returns a new Set containing all elements from the original
阅读全文
摘要:If The if statement is used to execute commands based on a condition. if [ condition ]; then commands fi Example: vim example.sh #!/bin/zsh echo "Ente
阅读全文
摘要:Commands: export: Set environment variables. env: View environment variables. echo: Display environment variables. Common Environment Variables: PATH:
阅读全文
摘要:Understanding File Permissions: File permissions in Unix-like systems determine who can read, write, or execute a file. They are represented as a comb
阅读全文
摘要:Finding elements starting from the end of an array has gotten a lot easier with the introduction of the at, findLast, and findLastIndex methods! With
阅读全文
摘要:Array Grouping is the new feature of JavaScript/ECMAScript, which splits an array (or, generally, an iterable), into smaller sub-arrays. Grouping is d
阅读全文
摘要:The sed command is a stream editor used for filtering and transforming text. sed 'command' file Create and view the initial content of sample.txt: ech
阅读全文
摘要:The awk command is a powerful text processing tool used for pattern scanning and processing. // exammple.txt Hello World This is a sample file Bash sc
阅读全文
摘要:The grep command searches for patterns within files and prints matching lines. grep [options] [content] [file] Search for a pattern in a file: grep "p
阅读全文
摘要:Head The head command is used to display the beginning of a file or the first few lines of input. It's a useful command for quickly viewing the start
阅读全文
摘要:The read command is used to take input from the user. Reading a single input value: echo "Enter your name:" read NAME echo "Hello, $NAME!" Output afte
阅读全文
摘要:The echo command is used to display a line of text or string that is passed as an argument. It's one of the most basic and frequently used commands in
阅读全文
摘要:The wc command computes the numbers of lines, words, and bytes in a file: wc notes.txt # > 3 7 35 /home/substack/notes.txt Count words wc -w notes.txt
阅读全文
摘要:return true is a number is odd /* _____________ Your Code Here _____________ */ type LastChar<T extends string> = T extends `${infer First}${infer Res
阅读全文
摘要:For example I want to override and rename file.txt_ with file.txt mv file.txt{_,} You can also check the full command with echo echo mv file.txt{_,} #
阅读全文
摘要:Prim's algorithm is a popular method used in computer science for finding a minimum spanning tree for a connected, undirected graph. This means it fin
阅读全文
摘要:ometimes you may want to determine whether a string literal is a definite type. For example, when you want to check whether the type specified as a cl
阅读全文
摘要:mkdir To make a new directory, just execute the mkdir command with a list of new directory names to make as arguments: mkdir hooray and now a new dire
阅读全文
摘要:mv The mv command is used to rename and overwrite files and directories. To rename a file, set the first argument to the original file name and the se
阅读全文
摘要:cp Copy file content from beep.txt to message.txt, create message.txt if not exists. cp beep.txt message.txt Copy file to a different directory cp bee
阅读全文
摘要:Implement a type IsUnion, which takes an input type T and returns whether T resolves to a union type. For example: type case1 = IsUnion<string> // fal
阅读全文
摘要:Sometimes, you might need to wait for an element to disappear from your UI before proceeding with your test setup or making your assertion. In this le
阅读全文
摘要:Querying is difficult! Even if we follow the guiding principles and always start from the queries accessible to everyone, we are bound to get stuck so
阅读全文
摘要:Given how web pages are built nowadays, you might find yourself with multiple instances of the same element. To avoid querying for a list of elements
阅读全文
摘要:Sync api: getBy* queryBy* Async api: findBy* For sync api, when to use which? queryBy*: when the element is not always shown on screen getBy*: when th
阅读全文
摘要:Use Capo.js to analyze what currently is - and what should be - the order of elements in your HEAD section of the document. After we know what the ord
阅读全文
摘要:in package.json: { "main": "./dist/build.umd.cjs", "module": "./dist/build.js", "exports": { ".": { "import": "./dist/build.js", "require": "./dist/bu
阅读全文