Skip to content

Instantly share code, notes, and snippets.

View amireshoon's full-sized avatar
🎲

Amirhossein Meydani amireshoon

🎲
View GitHub Profile
@amireshoon
amireshoon / matrixsum.py
Created June 18, 2021 15:17
Check two matrix and sum the keys if both equal to 1
m = [
[1,2,1,1,1,0,2,1,1],
[2,2,1,1,2,3,6,2,1],
[1,2,1,1,1,0,1,1,1],
[2,2,1,1,2,3,1,2,1]
]
for i in range(0, len(m), 2):
total = 0
for k,j in enumerate(m[i]):
@amireshoon
amireshoon / similar.py
Created March 10, 2021 16:54
Get similar word from a given word
from rapidfuzz import fuzz
import operator
"""
this function return similar value for given string with given dataset
first returned value will be similar word
seccond value is accuracy
"""
def find_similar(search_for, dataset):
res = []
@amireshoon
amireshoon / strea.py
Created December 4, 2020 12:33
Stream a youtube live in python with pafy and vlc
import pafy
import vlc
url = "https://www.youtube.com/watch?v=5qap5aO4i9A"
video = pafy.new(url)
best = video.getbest()
playurl = best.url
Instance = vlc.Instance()
player = Instance.media_player_new()
@amireshoon
amireshoon / app.go
Created September 3, 2020 12:53
BMI
package main
import (
"bufio"
"fmt"
"os"
"strconv"
"strings"
)
@amireshoon
amireshoon / app.go
Created September 3, 2020 12:52
BMI
if bmi < 18.5 {
fmt.Println(bmi)
fmt.Println("Underweight")
} else if bmi < 25 {
fmt.Println(bmi)
fmt.Println("Normal")
} else if bmi < 30 {
fmt.Println(bmi)
fmt.Println("Overweight")
} else if 30 < bmi {
@amireshoon
amireshoon / app.go
Created September 3, 2020 12:51
BMI
f := i2 * i2
bmi := float64(i) / f
@amireshoon
amireshoon / app.go
Created September 3, 2020 12:48
BMI
package main
import (
"bufio"
"fmt"
"os"
"strconv"
"strings"
)
@amireshoon
amireshoon / app.go
Created September 3, 2020 12:42
Calculate BMI
package main
func main() {
}
@amireshoon
amireshoon / pnums.go
Created August 14, 2020 11:51
Final figure
package main
import (
"bufio"
"fmt"
"os"
"strconv"
"strings"
)
@amireshoon
amireshoon / pnums.go
Created August 14, 2020 11:49
Creating loop
package main
import "bufio"
func main() {
reader := bufio.NewReader(os.Stdin)
a, err := reader.ReadString('\n')
if err != nil {
panic("input error")
}