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
@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",
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
ExportPlot <- function(gplot, filename, width=2, height=1.5) {
# Export plot in PDF and EPS.
# Notice that A4: width=11.69, height=8.27
ggsave(paste(filename, '.pdf', sep=""), gplot, width = width, height = height)
postscript(file = paste(filename, '.eps', sep=""), width = width, height = height)
print(gplot)
dev.off()
png(file = paste(filename, '_.png', sep=""), width = width * 100, height = height * 100)
print(gplot)
dev.off()
@ajokela
ajokela / imgscalr.rb
Created October 7, 2011 19:40 — forked from mchung/imgscalr.rb
imgscalr in jruby
require "imgscalr-lib" # https://github.com/thebuzzmedia/imgscalr
require "jruby"
java_import "javax.imageio.ImageIO"
ImageIO.write(
com.thebuzzmedia.imgscalr.Scalr.resize(
ImageIO.read(java.io.File.new("iss.jpg")),
250),
"jpg",
java.io.File.new("iss_new.jpg"))