Skip to content

Instantly share code, notes, and snippets.

Avatar

Christoph Klocker corck

View GitHub Profile
@corck
corck / main.py
Created Oct 24, 2019 — forked from ixje/main.py
find connected NEO nodes from coz monitor RPC list
View main.py
import requests
import ipaddress
def get_endpoints():
endpoints = []
response = requests.get("https://raw.githubusercontent.com/CityOfZion/neo-mon/master/docs/assets/mainnet.json")
response.raise_for_status()
if response.status_code == 200:
results = response.json()
for site in results['sites']:
@corck
corck / invoke.js.es6
Created Jun 11, 2019
Neo dAPI example to invoke a method with verification
View invoke.js.es6
//= require babel/polyfill
const network = 'PrivateNet'
const scriptHash = '58e7c597e246a11177580fdda62e0881b8e7e3c0'
class Account {
constructor(address, name) {
this.address = address
this.name = name
}
@corck
corck / verification.py
Created Jun 11, 2019
neo verfication example
View verification.py
from boa.interop.Neo.Runtime import GetTrigger,CheckWitness
from boa.interop.Neo.Storage import Get,Put,Delete,GetContext
from boa.interop.Neo.TriggerType import Application, Verification
def Main(operation, addr, value):
print("Running Sample v4")
trigger = GetTrigger()
# This determines that the SC is running in Verification mode
View script-to-little-endian.py
# Neo script to little-endian BigInteger
#!/usr/local/env python3
import binascii
script="011fc56b6a00527ac46a51527ac468164e656f2e53746f726167652e476574436f6e74657874616a52527ac46a00c30361646487646e0006616464696e67680f4e656f2e52756e74696d652e4c6f676a52c36a51c300c37c680f4e656f2e53746f726167652e476574616a53527ac46a53c36a51c351c3936a54527ac46a52c36a51c300c36a54c35272680f4e656f2e53746f726167652e507574616a54c36c7566616a00c30672656d6f7665876454006a52c36a51c300c37c680f4e656f2e53746f726167652e476574616a53527ac46a52c36a51c300c36a53c36a51c351c3945272680f4e656f2e53746f726167652e507574616a53c36a51c351c3946c7566616a00c30762616c616e6365876421006a52c36a51c300c37c680f4e656f2e53746f726167652e476574616c7566616a00c3076d69677261746587642401174d696772617465206f7065726174696f6e207374617274680f4e656f2e52756e74696d652e4c6f670207106a55527ac401056a56527ac4516a57527ac4136d6967726174656420636f6e747261637420336a58527ac403302e336a59527ac40b6c6f63616c68756d616e336a5a527ac40d6e657840656d61696c2e636f6d6a5b527ac40d74657374206d6967726174653
View neon-js-rpc-call
let url = "http://neo-privnet:30333";
const client = Neon.create.rpcClient(url, '2.3.2');
let id = this.get('model').id;
console.log(id);
client.getRawTransaction(id)
.then((res) => {
console.log(res)
})
@corck
corck / get-wif.sh
Created Jul 11, 2018
Get WIF from Neo Test Wallet
View get-wif.sh
# Start docker (Repo: https://github.com/slipo/neo-scan-docker)
docker-compose up
# Start Neo prompt
np-prompt -p -v
# Open Wallet
open wallet neo-privnet.wallet
# Export WIF
@corck
corck / lopy-wearic.py
Last active Jun 28, 2018
Lora Lopy wearic smart textile developer kit test. switch on and off leds through Lopy extension board.
View lopy-wearic.py
from network import LoRa
import pycom
import socket
import time
import binascii
import json
from network import WLAN
from network import Bluetooth
bt = Bluetooth()
View gist:22bb291cc9a9fa6dec673bca2060892b

Configuration

Allow anyonymous

allow_anonymous = on

@corck
corck / gist:d4c63e3908548963ce2e58b45d9976e2
Last active Feb 6, 2017
Restart Networkmanager on connection reset, restart VPN after network manager restart
View gist:d4c63e3908548963ce2e58b45d9976e2
For monitoring Network Manager connection and restart it on a dropped connection (eth/wifi). Make sure to specify the right interface below (eth0, wlan0...)
#/etc/init/reconnect.conf
start on started network-manager
stop on runlevel [016]
script
while true; do
if ifconfig eth0 | grep -q "inet addr:"; then
# echo "all ok!"
@corck
corck / gist:baf400b0598fc2c27e956af9b59ed6d4
Last active Jan 13, 2017
Ruby thingsnetwork example mqtt script
View gist:baf400b0598fc2c27e956af9b59ed6d4
require 'mqtt'
require 'base64'
require 'json'
app_id = APP_ID
access_key = ACCESS_KEY
dev_id = DEV_ID
region = eu
client = MQTT::Client.connect("mqtt://#{app_id}:#{access_key}@#{region}.thethings.network:1883")
You can’t perform that action at this time.