Skip to content

Instantly share code, notes, and snippets.

View anisbhsl's full-sized avatar
👨‍💻

Anish Bhusal anisbhsl

👨‍💻
View GitHub Profile
@anisbhsl
anisbhsl / guess_the_number.py
Last active February 2, 2023 05:29
Guess The Number : Binary Search Problem
"""
Q1: Two friends, Elaine and Tom, are playing a guessing game with each other.
Elaine thinks of an integer in her mind and Tom needs to guess the number.
Tom can ask a question as follows: Is your number greater than or equal to 5
(or any other specified integer)?
Then Elaine has to reply yes or no based on the comparison results of the two numbers.
Design an algorithm, in pseudo-code to help Tom find that number quick.
UAH CS 617 - Spring 2023
@anisbhsl
anisbhsl / graph.go
Last active November 20, 2022 19:44
Simple graph implementation (with BFS and DFS) in go using adj list
package main
import (
"fmt"
)
type Graph struct{
Nodes []*Node
}
@anisbhsl
anisbhsl / stack.go
Created November 17, 2022 15:56
Simple Stack Implementation in Go
package main
import (
"fmt"
)
type Node struct{
data int
next *Node
}
package main
import (
"fmt"
"log"
"github.com/bettercap/gatt"
"github.com/bettercap/gatt/examples/option"
"github.com/bettercap/gatt/examples/service"
)
package service
import "github.com/bettercap/gatt"
func NewBatteryService() *gatt.Service {
lv := byte(100)
s := gatt.NewService(gatt.UUID16(0x180F))
c := s.AddCharacteristic(gatt.UUID16(0x2A19))
c.HandleReadFunc(
func(rsp gatt.ResponseWriter, req *gatt.ReadRequest) {
package service
import (
"log"
"github.com/bettercap/gatt"
)
var (
attrGATTUUID = gatt.UUID16(0x1801)
attrServiceChangedUUID = gatt.UUID16(0x2A05)
package service
import "github.com/bettercap/gatt"
var (
attrGAPUUID = gatt.UUID16(0x1800)
attrDeviceNameUUID = gatt.UUID16(0x2A00)
attrAppearanceUUID = gatt.UUID16(0x2A01)
attrPeripheralPrivacyUUID = gatt.UUID16(0x2A02)
package main
import (
"bufio"
"gocv.io/x/gocv"
"image"
"image/color"
"log"
"os"
"fmt"
{
package main
import (
"encoding/json"
"reflect"
"learn-peg/parser/utils/postfix"
)
type Query struct{
Collection string
{
package main
import (
"encoding/json"
"reflect"
)
type Query struct{
Collection string
Condition []string