Skip to content

Instantly share code, notes, and snippets.

View anisbhsl's full-sized avatar
👨‍💻

Anish Bhusal anisbhsl

👨‍💻
View GitHub Profile
@anisbhsl
anisbhsl / floatingBytesOrdering.go
Created November 4, 2019 05:24
Orders floating point numbers in byte order
package main
import(
"encoding/binary"
//"encoding/binary"
"fmt"
"math"
)
func main(){
package main
import (
"encoding/json"
"fmt"
"github.com/gorilla/mux"
"golang.org/x/oauth2"
"io/ioutil"
"log"
@anisbhsl
anisbhsl / sql.peg
Created January 20, 2020 06:50
PEG parser for SQL queries (Select and Insert) in Go
/*Initializer code block */
{
package main
import (
"strconv"
"strings"
)
type SelectQuery struct{
SelectFields []string
{
package main
import (
"encoding/json"
"reflect"
)
type Query struct{
Collection string
Condition []string
{
package main
import (
"encoding/json"
"reflect"
"learn-peg/parser/utils/postfix"
)
type Query struct{
Collection string
package main
import (
"bufio"
"gocv.io/x/gocv"
"image"
"image/color"
"log"
"os"
"fmt"
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 service
import (
"log"
"github.com/bettercap/gatt"
)
var (
attrGATTUUID = gatt.UUID16(0x1801)
attrServiceChangedUUID = gatt.UUID16(0x2A05)
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 main
import (
"fmt"
"log"
"github.com/bettercap/gatt"
"github.com/bettercap/gatt/examples/option"
"github.com/bettercap/gatt/examples/service"
)