Skip to content

Instantly share code, notes, and snippets.

View amirphl's full-sized avatar
🎯
Focusing

Amir M Pirhosseinloo amirphl

🎯
Focusing
View GitHub Profile
@amirphl
amirphl / README.md
Created July 14, 2024 10:40
arch linux, dns, proxy
@amirphl
amirphl / WSL-PROXY.md
Last active July 7, 2024 13:37
Putting WSL2 behind proxy
https://dev.deluge-torrent.org/wiki/UserGuide/ThinClient
https://deluge.readthedocs.io/en/latest/how-to/systemd-service.html
https://forum.deluge-torrent.org/viewtopic.php?f=9&t=49679
@amirphl
amirphl / add-two-numbers.go
Last active October 20, 2023 14:29
Interview question + solution
/*
You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order,
and each of their nodes contains a single digit. Add the two numbers and return the sum as a linked list.
You may assume the two numbers do not contain any leading zero, except the number 0 itself.
Example 1:
Input: l1 = [2,4,3], l2 = [5,6,4]
Output: [7,0,8]
Explanation: 342 + 465 = 807.
@amirphl
amirphl / interview-problem.go
Last active October 21, 2023 23:01
Interview question
/*
We have a list of destinations (cells) and a list of agents. We want to find the closest agent-destination pair. If multiple pairs are found, we choose the agent with the lower priority. Then, the agent walks to the destination and the destination is removed from the list of destinations. The agent then becomes free.
We want to assign agents to destinations as soon as possible. We can model this problem in Go as follows:
*/
package main
import (
"fmt"
"sort"
@amirphl
amirphl / go-first
Last active October 15, 2022 11:50
Most recommended libs, frameworks, practices, design, ...
Golang:
- https://github.com/avelino/awesome-go
- https://github.com/tmrts/go-patterns
- https://github.com/quii/learn-go-with-tests
- https://github.com/inancgumus/learngo
- https://github.com/Alikhll/golang-developer-roadmap
- https://github.com/hoanhan101/ultimate-go
- https://github.com/dariubs/GoBooks
- https://golang.org/ref/mod
- https://github.com/geektutu/7days-golang
@amirphl
amirphl / editor.md
Last active May 19, 2023 09:03
make vim a good editor for Golang and Scala

To switch back between Golang and Scala: init.vim and init.lua

Golang

I followd the guide provided by this guy (https://octetz.com/docs/2019/2019-04-24-vim-as-a-go-ide/) and faced some problems:

  • The vim.plug should be copied inside ~/.config/nvim/autoload/ not ~/.var/app/io.neovim.nvim/data/nvim/site/autoload/.
  • The command :GoInstallBinaries installs the binaries like gopls (in my case) inside $HOME/go/bin. Therefore, $HOME/go/bin must be appended to the $PATH variable.
if [ -d "$HOME/go/bin" ] ; then
 PATH="$PATH:$HOME/go/bin"