Skip to content

Instantly share code, notes, and snippets.

View simform-solutions's full-sized avatar

Simform simform-solutions

View GitHub Profile
@simform-solutions
simform-solutions / RetrofitException.java
Last active May 21, 2019 20:36
RxErrorHandlingCallAdaptorFactory+RxJava2 global retrofit error handler.
import com.google.gson.stream.MalformedJsonException;
import java.io.IOException;
import java.lang.annotation.Annotation;
import okhttp3.ResponseBody;
import retrofit2.Converter;
import retrofit2.Response;
import retrofit2.Retrofit;
@simform-solutions
simform-solutions / MultiLinesTextViewUtils.kt
Created April 9, 2018 14:10
Get text on each line into array from multiline textView.
import android.os.Build
import android.view.ViewTreeObserver
import android.widget.TextView
/**
*Created by Amit.Bhati on 08/04/18.
*/
class MultiLinesTextViewUtils(builder: Builder) {
private var getLines: GetLines = builder.getListener()!!
pragma solidity ^0.4.15;
/**
* Overflow aware uint math functions.
*/
contract SafeMath {
//internals
function safeMul(uint a, uint b) internal pure returns (uint) {
uint c = a * b;
0x26FB0db2d1928528106dA9Cc9Be97e768aEe3e94
0x97178e7f1352da4Cf4Be0eCe8Ddb034F6c61214e
# The function that rules them all!
# This function will be called when the script is executed and will ask the user for the seed and then listens to
# the users commands. All functions above will be called directly or indirectly through this function.
def main():
ask_seed = True
while ask_seed:
global seed
global file_name
seed = log_in()
file_name = create_file_name()
# Gets all assosiated transactions from the saved addresses and saves the transaction data in the account file
def get_transfers(full_history, print_history=True):
account_history_executing = True
api = Iota(iota_node, seed)
address_count = len(address_data)
all_txn_hashes = []
saved_txn_hashes = []
new_txn_hashes = []
i = 0
#rotate servo motor according to transaction
def rotate_motor():
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(25, GPIO.OUT)
pwm=GPIO.PWM(25,50)
pwm.start(7.5)
try:
#execute command according to transaction tag
#To turn on led use this command TURNONLED999999999999999999
#To turn off led use this command TURNOFFLED99999999999999999
#To rotate servo motor use this command TURNONSERVO9999999999999999
def execute_command(command):
print("Transaction tag: " + command)
if command == 'TURNONLED':
blink_led(True)
elif command == 'TURNOFFLED':
blink_led(False)