Skip to content

Instantly share code, notes, and snippets.

View feliperyan's full-sized avatar

Felipe Ryan feliperyan

  • Cloudflare
  • Sydney, Australia
  • 11:49 (UTC +11:00)
View GitHub Profile
@feliperyan
feliperyan / drone_simulation.go
Created July 17, 2019 14:01
Will convert getPositionTowardsDestination() to interpolation next!
package main
import (
"fmt"
"math"
)
type GPSCoord struct {
Lat float64
Lon float64
@feliperyan
feliperyan / websocket_graceful.go
Last active April 23, 2021 14:55
An attempt to gracefully shutdown websockets on go using gorilla/websockets
package main
import (
"context"
"fmt"
"github.com/gorilla/websocket"
"log"
"net/http"
"os"
"os/signal"
@feliperyan
feliperyan / client.go
Last active May 3, 2019 15:56
websocket client
package main
import (
"bufio"
"encoding/json"
"flag"
"fmt"
"log"
"net/url"
"os"
@feliperyan
feliperyan / beholder.go
Last active May 3, 2019 15:55
websocket control centre
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"os"
"strings"
@feliperyan
feliperyan / server.go
Last active May 3, 2019 15:55
websocket golang
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"
### Keybase proof
I hereby claim:
* I am feliperyan on github.
* I am fryan (https://keybase.io/fryan) on keybase.
* I have a public key ASAjRo41sVidSbYZfUdkXjsAYJPUbvEi2IuzTmr0-g0-pQo
To claim this, I am signing this object:
@feliperyan
feliperyan / load_modle_from_pickle_v2.ipynb
Created February 14, 2018 00:08
Jupyter notebook showing how to load a model and vectoriser and apply it. Results in 2 csv files one with predicted data and one with words that the model has never seen before.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@feliperyan
feliperyan / make_model.py
Created February 13, 2018 23:39
Using scikit-learn to do text categorisation and to save a model and a one-hot encoder
import pickle
import pandas as pd
import re
import numpy as np
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.ensemble import RandomForestClassifier
from sklearn import metrics
from sklearn.model_selection import train_test_split
from time import time
@feliperyan
feliperyan / get_lat_lon_exif_pil.py
Created October 23, 2017 12:53 — forked from erans/get_lat_lon_exif_pil.py
Get Latitude and Longitude from EXIF using PIL
from PIL import Image
from PIL.ExifTags import TAGS, GPSTAGS
def get_exif_data(image):
"""Returns a dictionary from the exif data of an PIL Image item. Also converts the GPS Tags"""
exif_data = {}
info = image._getexif()
if info:
for tag, value in info.items():
decoded = TAGS.get(tag, tag)
@feliperyan
feliperyan / exif.py
Created October 22, 2017 11:15 — forked from ishahid/exif.py
Read EXIF data from an image
#!/usr/local/bin/python
"""Read EXIF data from an image
https://gist.github.com/ishahid/137f8724d8cff2304dffd69f3ade26d7
"""
try:
import os, sys
# import json
from PIL import Image