Skip to content

Instantly share code, notes, and snippets.

View ajokela's full-sized avatar

A.C. Jokela ajokela

View GitHub Profile
@ajokela
ajokela / helium_network_graphs.py
Created November 5, 2022 13:24 — forked from evandiewald/helium_network_graphs.py
Generate the Helium network graph for a city.
from get_data import *
import math
import networkx as nx
import h3
import json
from torch_geometric.utils import from_networkx
from torch_geometric.data import Data
import pickle
import torch
import torch.nn.functional as F
from torch_geometric.nn import GCNConv, AGNNConv, SAGEConv, XConv
from torch_geometric.data import Data, DataLoader, Dataset
import pickle
from torch.nn import Linear, ReLU, Flatten
import random
import numpy as np
import matplotlib.pyplot as plt
from get_data import get_city_details
import requests
import datetime
import h3
import networkx as nx
import urllib
import numpy as np
import pandas as pd
import time
import random
#include <lmic.h>
#include <hal/hal.h>
#include <DHT.h>
#define DHTTYPE DHT22 // DHT 22 (AM2302)
#define DHTPIN 8
DHT dht(DHTPIN, DHTTYPE);
@ajokela
ajokela / DHT22node.ino
Created October 8, 2022 16:21 — forked from NorHairil/DHT22node.ino
Code for LoRa node with DHT22 sensor
/*******************************************************************************
* Copyright (c) 2015 Thomas Telkamp and Matthijs Kooijman
* Copyright (c) 2018 Terry Moore, MCCI
*
* Permission is hereby granted, free of charge, to anyone
* obtaining a copy of this document and accompanying files,
* to do whatever they want with them without any restriction,
* including, but not limited to, copying, modification and redistribution.
* NO WARRANTY OF ANY KIND IS PROVIDED.
*
@ajokela
ajokela / PythonHydeS3.md
Last active September 2, 2022 17:27 — forked from evz/README.md
S3 Publisher for Hyde (static site generator written in Python)

How to use

  • Add the s3.py file to your project. As an example, put it inside a folder called publishers.
  • The folder where s3.py resides must be a Python package, so add an empty __init__.py file to that folder also.
  • Add the following configuration to your site.yaml and modify it as needed:
publisher:
    s3:
 type: publishers.s3.S3 # here, publishers is the folder where the s3.py file was placed
@ajokela
ajokela / SerialPrintf.txt
Created August 27, 2022 02:49 — forked from ridencww/SerialPrintf.txt
Basic printf functionality for the Arduino serial ports
/*
* Simple printf for writing to an Arduino serial port. Allows specifying Serial..Serial3.
*
* const HardwareSerial&, the serial port to use (Serial..Serial3)
* const char* fmt, the formatting string followed by the data to be formatted
*
* int d = 65;
* float f = 123.4567;
* char* str = "Hello";
* serial_printf(Serial, "<fmt>", d);
@ajokela
ajokela / getAllHeliumAPICursor.py
Created May 6, 2022 01:06 — forked from mfalkvidd/getAllHeliumAPICursor.py
Helium API get all data using cursor
#!/usr/bin/env python3
import requests
import json
import sys
from optparse import OptionParser
params = {
"count": "10000",
@ajokela
ajokela / Albers to WGS84 - Ruby
Last active March 16, 2017 13:55
Convert Albers projection values to WGS84 projection values (ruby)
# CONSUS Albers consts (EPSG: 5070)
RE_NAD83 = 6378137.0
E_NAD83 = 0.0818187034 #Eccentricity
D2R = 0.01745329251 #Pi/180
def calcPhi(i)
sinPhi = Math.sin(i * D2R)
return (1.0 - pow(E_NAD83, 2.0)) * ((sinPhi/(1.0 - pow((E_NAD83 * sinPhi), 2.0))) - 1.0/(2.0 * E_NAD83) * Math.log((1.0 - E_NAD83 * sinPhi)/(1.0 + E_NAD83 * sinPhi)))
end
Module#recursive_const_get
class Module
def recursive_const_get(name)
name.to_s.split("::").inject(self) do |b, c|
b.const_get(c)
end
end
end
#Example