Skip to content

Instantly share code, notes, and snippets.

View simform-solutions's full-sized avatar

Simform simform-solutions

View GitHub Profile
account add app backup can categori data expens incom manag money month person report spend track use will
5 0 1 0 2 2 1 4 1 4 1 0 2 2 0 1 4 1
3 4 0 1 1 2 2 4 0 1 0 0 0 1 1 3 5 1
3 1 3 2 2 3 2 5 3 4 5 2 1 1 8 4 2 3
3 1 4 3 4 5 3 6 1 2 0 3 1 3 0 4 0 0
0 0 0 1 4 1 0 4 2 0 2 3 0 3 0 1 1 1
1 2 4 1 2 3 2 18 6 3 0 4 1 0 1 5 0 0
9 0 1 3 13 3 3 8 1 15 11 2 5 1 2 2 1 0
0 0 0 0 3 1 3 2 0 2 2 1 0 0 1 1 0 2
1 4 5 0 0 1 1 5 0 1 1 1 3 1 1 4 0 3
@simform-solutions
simform-solutions / LocationUpdateFragment.java
Last active April 21, 2017 05:09
LocationUpdateFragment - Android
package com.places;
import android.app.Activity;
import android.app.Fragment;
import android.content.Intent;
import android.content.IntentSender;
import android.location.Location;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.util.Log;
@simform-solutions
simform-solutions / iota_python.py
Last active May 28, 2019 15:41
Proof of work on python based IOTA implementation. Python 2.7 (not compatible yet with python 3) and the PyOTA library ***pip install pyota***
import getpass
import hashlib
import json
import time
import datetime
import re
import os
import RPi.GPIO as GPIO
from operator import itemgetter
# Takes a address (81 Characters) and converts it to an address with checksum (90 Characters)
def address_checksum(address):
bytes_address = bytes(address)
addy = Address(bytes_address)
address = str(addy.with_valid_checksum())
return address
# Takes an address with checksum and verifies if the address matches with the checksum
def is_valid_address(address_with_checksum):
address = address_with_checksum[:81]
# Generates one or more addresses and saves them in the account file
def generate_addresses(count):
index_list = [-1]
for data in address_data:
index = data["index"]
index_list.append(index)
if max(index_list) == -1:
start_index = 0
else:
# Sends a request to the IOTA node and gets the current confirmed balance
def address_balance(address):
api = Iota(iota_node)
gna_result = api.get_balances([address])
balance = gna_result['balances']
return balance[0]
# Checks all addresses that are saved in the account file and updates there balance
# start_index can be set in order to ignore all addresses befor the start index
import getpass
import hashlib
import json
import time
import datetime
import re
import os
import RPi.GPIO as GPIO
from operator import itemgetter
# Creates a unique file name by taking the first 12 characters of the sha256 hash from a seed
def create_file_name():
seed_hash = create_seed_hash(seed)
file_name = seed_hash[:12]
file_name += ".txt"
return file_name
# The login screen; Will make sure that only a valid seed is enterd
def log_in():
# Will try to open the account file. In case the file doesn't exist it will create a new account file.
def read_account_data():
try:
with open(file_name, 'r') as account_data:
data = json.load(account_data)
return data
except:
with open(file_name, 'w') as account_data:
data = {}
# Updates the f_index and l_index
def update_fal_balance():
index_with_value = []
for data in address_data:
if data["balance"] > 0:
index = data["index"]
index_with_value.append(index)
if len(index_with_value) > 0: