This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Author: Tri Le | |
| // Date: 2022-02-26 | |
| package main | |
| import "fmt" | |
| type node struct { | |
| val int | |
| left *node |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sudo dscl . -append /groups/wheel GroupMembership <username> | |
| # now `sudo visudo` and remove comment from: %wheel ALL=(ALL) NOPASSWD: ALL |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.javaniosample; | |
| import java.io.IOException; | |
| import java.net.InetSocketAddress; | |
| import java.nio.ByteBuffer; | |
| import java.nio.channels.SelectionKey; | |
| import java.nio.channels.Selector; | |
| import java.nio.channels.ServerSocketChannel; | |
| import java.nio.channels.SocketChannel; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void process(Socket socket) { | |
| InputStream in = socket.getInputStream(); | |
| OutputStream out = socket.getOutputStream(); | |
| BufferedReader reader = new BufferedReader(in); | |
| HttpRequest request = new HttpRequest(); | |
| HttpResponse response = new HttpResponse(); | |
| while (true) { | |
| // read some byte and parse the request (1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.io.*; | |
| import java.net.*; | |
| class MyThread extends Thread{ | |
| Queue<Socket> queue = new LinkedList<Socket>(); | |
| public void putSocket(Socket socket) { | |
| queue.add(socket); | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.io.*; | |
| import java.net.*; | |
| public class MyServer { | |
| public static void main(String[] args){ | |
| try { | |
| ServerSocket ss=new ServerSocket(6666); | |
| while (true) { | |
| Socket s = ss.accept(); //establishes connection |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "posts": [ | |
| { "id": 1, "title": "json-server", "author": "typicode" } | |
| ], | |
| "comments": [ | |
| { "id": 1, "body": "some comment", "postId": 1 } | |
| ], | |
| "profile": { "name": "typicode" }, | |
| "trips": [ | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 1. Install Fira Mono | |
| 2. Install Fira Code https://github.com/tonsky/FiraCode | |
| 3. Setting VSCode | |
| "editor.fontFamily": "Fira Code", | |
| "editor.fontLigatures": true, | |
| "editor.fontWeight": "500" // Medium | |
| 4. Font theme color: One Dark Pro |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [alias] | |
| 5 lg1 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(b old yellow)%d%C(reset)' --all | |
| 6 lg2 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)% n''%C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all | |
| 7 lg3 = log --pretty --graph --all --abbrev-commit --decorate | |
| 8 lg = !"git lg1" |