Skip to content

Instantly share code, notes, and snippets.

View trileminh94's full-sized avatar
🤩
coding

Le Minh Tri trileminh94

🤩
coding
View GitHub Profile
// Author: Tri Le
// Date: 2022-02-26
package main
import "fmt"
type node struct {
val int
left *node
@trileminh94
trileminh94 / gist:c4dd2860fce7d1c445fe68d0fdc29b26
Created July 3, 2020 10:53 — forked from shayne/gist:3086902
Add Mac OS X user to "wheel" group (no more sudo passwd)
sudo dscl . -append /groups/wheel GroupMembership <username>
# now `sudo visudo` and remove comment from: %wheel ALL=(ALL) NOPASSWD: ALL
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;
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)
import java.io.*;
import java.net.*;
class MyThread extends Thread{
Queue<Socket> queue = new LinkedList<Socket>();
public void putSocket(Socket socket) {
queue.add(socket);
}
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
{
"posts": [
{ "id": 1, "title": "json-server", "author": "typicode" }
],
"comments": [
{ "id": 1, "body": "some comment", "postId": 1 }
],
"profile": { "name": "typicode" },
"trips": [
{
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
@trileminh94
trileminh94 / .gitconfig
Created November 22, 2018 16:30
GitConfig alias for beautiful log
[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"