Skip to content

Instantly share code, notes, and snippets.

View CrackerHax's full-sized avatar

MEGACHAD CrackerHax

View GitHub Profile
@CrackerHax
CrackerHax / rightclick.js
Last active September 14, 2019 11:21
Simple right click menu script for highfidelity.io
// Simple Right Click Menu by Cracker Hax
// declare some arrays
var btn=[];
var txt=[];
// define our menu items
var cmd = ["Menu Item 1","Menu Item 2","Menu Item 3"];
// define button size
@CrackerHax
CrackerHax / JsonRPC.js
Last active September 14, 2019 11:21
Sample JsonRPC code for highfidelity.io
function post(method,params)
{
var r_txt ='{"jsonrpc":"2.0","method":"'+method+'","params":{'+params+'},"id":1234}';
var http = new XMLHttpRequest();
http.open("POST", 'http://foo.com:8082', true);
http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http.setRequestHeader("Content-length", r_txt.length);
http.setRequestHeader("Connection", "close");
http.onreadystatechange = function() {
if (http.readyState == 4) {
@CrackerHax
CrackerHax / gist:18855905c998a2f0dca3
Last active September 14, 2019 11:20
Forced Overlay Test Script for highfidelity.io
(function()
{
// define colors
var black = { red: 0, green:0, blue:0};
var white = { red: 255, green:255, blue:255};
var window = [];
function newWindow(posx,posy)
{
@CrackerHax
CrackerHax / scriptending_test.js
Last active September 14, 2019 11:19
Another Script.scriptending test script for highfidelity.io
function scriptStopped()
{
print("script stopped");
}
Script.scriptEnding.connect(scriptStopped);
@CrackerHax
CrackerHax / hifi_websocket_test.js
Last active November 17, 2015 22:10
A script to test your highfidelity websockets
var wsUri = "ws://echo.websocket.org";
var wssUri = "wss://echo.websocket.org";
var connection;
function load(uri) {
connection = new WebSocket(uri);
connection.onopen = function () {
var send = "Hello, world!";
@CrackerHax
CrackerHax / create_tfrecord.py
Last active June 3, 2019 13:48
Create tfrecords labeled by category from directories of images
from random import shuffle
import glob
import sys
import cv2
import numpy as np
import tensorflow as tf
name = 'mountains' # name of your project directory where all images are
# should be under ./images/train (or change the path variable below)
image_size = 256 # size of images - should be square images (i.e. 256x256)
@CrackerHax
CrackerHax / datasets.py
Last active June 5, 2019 13:35
Replacement datasets.py for google/compare_gan/compare_gan (https://github.com/google/compare_gan) to load custom .tfrecords
# coding=utf-8
# Copyright 2018 Google LLC & Hwalsuk Lee.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
@CrackerHax
CrackerHax / ecrecover.cpp
Last active June 21, 2023 13:59
C++ ethereum ecRecover function using libsecp256k1 (with recovery module enabled) and keccak-tiny. Returns public eth address from signed message. Used to prove ownership of an eth address for logging in, etc.
#include "keccak-tiny.h"
#include "secp256k1.h"
#include "secp256k1_recovery.h"
std::string bytes_to_hex_string(const uint8_t *str, const uint64_t s)
{
std::ostringstream ret;
for (size_t i = 0; i < s; ++i)
ret << std::hex << std::setfill('0') << std::setw(2) << std::nouppercase << (int) str[i];
@CrackerHax
CrackerHax / getPubKey.py
Created September 14, 2019 11:39
Python script for getting ethereum public key from transaction id
import web3
w3 = web3.Web3(web3.HTTPProvider('https://geth.golem.network:55555'))
tx = w3.eth.getTransaction('0x00ee93fd1e6fdbdf841b4458a078210449dce89525502c965fd3534ba397e2e3')
tx.hash
from eth_account._utils.signing import extract_chain_id, to_standard_v
s = w3.eth.account._keys.Signature(vrs=(
to_standard_v(extract_chain_id(tx.v)[1]),
w3.toInt(tx.r),
@CrackerHax
CrackerHax / quickstart3.sh
Last active May 11, 2020 14:21
Multiple Fusenet Validator Nodes
#!/bin/bash
set -e
ENV_FILE=".env"
DOCKER_IMAGE_PARITY="fusenet/node"
DOCKER_CONTAINER_PARITY="fusenet"
DOCKER_IMAGE_APP="fusenet/validator-app"
DOCKER_CONTAINER_APP="fuseapp:"
DOCKER_IMAGE_NETSTAT="fusenet/netstat"
DOCKER_CONTAINER_NETSTAT="fusenetstat"