Skip to content

Instantly share code, notes, and snippets.

View mattkanwisher's full-sized avatar

Matthew Campbell mattkanwisher

View GitHub Profile
@mattkanwisher
mattkanwisher / YouTube_LG_WebTV.js
Created January 11, 2020 18:28
Launch Youtube on LG TV to a specific video
// To run
// npm install lgtv2
// node YouTube_LG_WebTV.js
var lgtv = require("lgtv2")({
url: 'ws://192.168.1.XX:3000' //Change XX to whatever the ip of your television is
});
lgtv.on('error', function (err) {
console.log(err);
{
"jsonrpc": "2.0",
"id": "",
"result": {
"block_height": "2957655",
"validators": [
{
"address": "00B587BAA478C3FCD0A1AE34658764BCE01A2A41",
"pub_key": {
"type": "tendermint/PubKeyEd25519",
pragma solidity ^0.4.13;
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
pragma solidity ^0.4.13;
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
pragma solidity ^0.4.13;
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
pragma solidity ^0.4.13;
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
pragma solidity ^0.4.13;
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
pragma solidity ^0.4.13;
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
const privateKey = CryptoUtils.generatePrivateKey()
const publicKey = CryptoUtils.publicKeyFromPrivateKey(privateKey)
const client = getClient(privateKey, publicKey)
const from = LocalAddress.fromPublicKey(publicKey).toString()
const web3 = new Web3(new LoomProvider(client))
this.user = from
const ABI = [{"constant":false,"inputs":[{"name":"_postId","type":"uint256"},{"name":"_text","type":"string"}],"name":"newComment","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"posts","outputs":[{"name":"text","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"commentFromAccount","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_text","type":"string"}],"name":"newPost","outputs":[],"payable":false,"stateMutability":"non
$ cat command.json
{
"method": "subevents",
"jsonrpc": "2.0",
"params": [],
"id": "dontcare"
}
$ wscat -k ws://localhost:9999/queryws < command.json
{