Skip to content

Instantly share code, notes, and snippets.

View andyjsbell's full-sized avatar
🕊️
Peaceful thoughts

Andy Bell andyjsbell

🕊️
Peaceful thoughts
  • Murcia, Spain
View GitHub Profile
@andyjsbell
andyjsbell / ethereum-address.js
Created September 4, 2021 19:24
ethereum address
const BN = require('bn.js');
const EC = require('elliptic').ec;
const keccak256 = require('js-sha3').keccak256;
const sk = new BN('616E6769652E6A6A706572657A616775696E6167612E6574682E6C696E6B0D0A', 16);
const ec = new EC('secp256k1'); // Elliptic curve used by Ethereum
const G = ec.g; // Elliptic curve generator point
// console.log(G.getX());
plugins {
id 'com.android.application'
}
android {
compileSdkVersion 29
defaultConfig {
applicationId "com.example.testawsiot"
minSdkVersion 26
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:4.1.0"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
use std::sync::{Arc, Mutex};
#[derive(Clone)]
struct Obj {
pub c: u32,
}
fn main() {
let obj = Arc::new(Mutex::new(Obj{c:0}));
#![recursion_limit = "512"]
use cpp::cpp;
use cpp::cpp_class;
use std::ffi::{CString, CStr};
use std::os::raw::c_char;
cpp!{{
#include <iostream>
#include "src/Test.cpp"
using std::string;
struct Operations {
count: u32,
}
impl Operations {
pub fn new() -> Self {
Operations{
count: 0,
}
}
struct Store<'a> {
items: Vec<&'a Item>,
}
struct Item {
name: String,
}
impl<'a> Store<'a> {
pub fn new() -> Self {
use cpp::cpp;
use cpp::cpp_class;
cpp!{{
#include <iostream>
using std::string;
class Test {
public:
use cpp::cpp;
use cpp::cpp_class;
cpp!{{
#include <iostream>
class Test {
public:
void fireEvent() {
std::cout << "fireEvent called" << std::endl;
onEvent(100, 200);
use cpp::cpp;
use cpp::cpp_class;
cpp!{{
#include <iostream>
class Test {
public:
void method() {
std::cout << "method called" << std::endl;
methodImpl();