Skip to content

Instantly share code, notes, and snippets.

View dansku's full-sized avatar
🌮
Focusing on tacos

Daniel Andrade dansku

🌮
Focusing on tacos
View GitHub Profile
@dansku
dansku / github_download.py
Created April 3, 2023 22:14
download all json files from a folder
import os
import requests
from bs4 import BeautifulSoup
import json
def download_file(url, local_filename):
with requests.get(url, stream=True) as r:
r.raise_for_status()
with open(local_filename, 'wb') as f:
@dansku
dansku / clean.py
Created December 28, 2022 13:35
Delete older download files
import os, time
dir_path = ""
def file_age(filepath):
age = time.time() - os.path.getmtime(filepath)
minutes = int(age) / 60
hours = minutes / 60
days = hours / 24
return days
func getGeoBoundaries(hex string) string {
bondaries := h3.ToGeoBoundary(h3.FromString(hex))
// Iterate between all points
bondariesText := ""
for _, p := range bondaries {
bondariesText += fmt.Sprintf("%v %v,", p.Longitude, p.Latitude)
}
dic = {
"musicas": [
{"nome": "Hey jude", "banda": "Beatles"},
{"nome": "november rain", "banda": "Gun n' roses"},
{"nome": "How deep is your love", "banda": "Bee Gees"},
],
"filmes": {
"x-men": ["wolvwrine", "xavier", "tempestade", "Vampira", "Magneto", "Ciclope", "Gambit"],
"Avengers": ["Homen de ferro", "Hulk", "Thanos", "Capitão America", "Thor", "Capitã Marvel", "Homem-Aranha"],
"Star Wars": ["Luke", "Leia", "c-3PO", "Darth Vader", "Obi-wan", "Yoda", "R2-D2", "Han solo", "chewbacca"],
@dansku
dansku / main.py
Created May 1, 2022 01:57
aula 01
import test
print("OLA GATINHO")
@dansku
dansku / grant.md
Last active September 30, 2022 08:42
dewi bounty api grant

DeWi Bounty Program

Public Helium API

The helium network started as a centralized network where the entire infrastructure (besides the hotpots) were deployed and managed by the Helium, inc. With the growth of the network, centralization starts to become an issue, where, as a completely decentralized network must work and grow even in the case of a failure of one of the main supporters (in this case, helium as a company).

At the current stage, most people, companies, and entities that interacts with the blockchain data utilizes the open API endpoints provided by helium, https://api.helium.io, which used to work smoothly until the network started to grow and the usage of the API skyrocketed causing multiple issues, from disrupting the wallet app in which most people use to monitor and manage their HNT.

This bounty comes in place to incentivize users to run their own infrastructure in order to reduce the current single-point of failure and load from the single API provided by helium, increase the decen

@dansku
dansku / helium_etl.md
Last active July 18, 2023 16:18
Helium ETL Setup Tutorial

Setting up a Helium ETL

This documents explains a quick intro how to setup your own ETL server for the Helium Blockchain. Running an ETL is not an easy task, but hopefully this document will help you get started, and by the end you will have the blockchain up and running.

Server Requirements

  • 2TB SSD (NVME prefered) disk

Install and configure PostgreSQL + PostGis

@dansku
dansku / etl_backups.sh
Last active August 8, 2021 11:01
etl snapshot script.
#!/bin/bash
# Variables
ETL_DIR=/root/blockchain-etl
ETL_USER=etl
ETL_DB=etl
ETL_PASS=etl
EXPORT_CORES=32
PSQL_HOST=localhost
EXPORT_DIR=/root/export
@dansku
dansku / minerChecker.sh
Created September 14, 2020 15:30
helium gatewau height checker
while true; do
miner01=$(docker exec miner001 miner info height | awk '{print $2}')
miner02=$(docker exec miner002 miner info height | awk '{print $2}')
miner03=$(docker exec miner003 miner info height | awk '{print $2}')
folder01=$(du -hs minerdata001 | awk '{print $1}')
folder02=$(du -hs minerdata002 | awk '{print $1}')
folder03=$(du -hs minerdata003 | awk '{print $1}')
@dansku
dansku / interfaces.go
Created September 1, 2020 13:16
List all network interfaces in go
package main
import (
"fmt"
"net"
)
func localAddresses() {
ifaces, err := net.Interfaces()
if err != nil {