Skip to content

Instantly share code, notes, and snippets.

@9876691
9876691 / app.js
Last active September 7, 2018 13:12
function $(id) { return document.getElementById(id) }
import Bitcoin from "bitcoinjs-lib"
document.addEventListener("DOMContentLoaded", ()=>{
const btn = $('create-address');
if(! btn)
return
@9876691
9876691 / index.cr
Last active September 7, 2018 13:50
class Bitcoins::Index < BrowserAction
get "/bitcoins" do
addresses = Array(Tuple(String, String, String)).new
render IndexPage, addresses: addresses
end
end
abstract class MainLayout
# Edit shared layout code in src/components/shared/layout.cr
include Shared::Layout
# 'needs current_user : User' makes it so that the current_user
# is always required for pages using MainLayout
needs current_user : User
def render
html_doctype
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.AddressAPIApi;
import java.io.File;
import java.util.*;
public class AddressAPIApiExample {
class Api::Addresses::Balance < ApiAction
param contract_id : String?
param decimal_places : Int32?
before check_for_valid_api_key
before check_valid_coins
get "/api/address/balance/:coin/:address" do
module OnChain
module Protocol
class ZCashTransaction < UTXOTransaction
property version_group_id : UInt32
property join_split_size : UInt64
property expiry_height : UInt32
def initialize(unspents : Array(UnspentOut), outputs : Array(UTXOOutput))
@9876691
9876691 / exampl.cr
Last active July 26, 2018 09:12
hash_signature_for_input
def hash_signature_for_input(input_idx : Int32) : String
buffer = IO::Memory.new
# 1. Version
buffer.write_bytes(ver, IO::ByteFormat::LittleEndian)
# 2. Inputs
Transaction.write_var_int(buffer, inputs.size.to_u64)
inputs[input_idx].to_buffer(buffer)
@9876691
9876691 / TestDSConnection.kt
Created October 24, 2017 08:17
Create a DSConnection from Kotlin.
import com.calypso.tk.util.ConnectionUtil
import java.io.FileOutputStream
import java.io.IOException
import java.io.File
import java.net.URL
fun main(args : Array<String>) {
addSSLSettings()
@9876691
9876691 / UseDataServer.java
Created October 24, 2017 07:33
Access secure data server.
import com.calypso.tk.core.Log;
import com.calypso.tk.core.Trade;
import com.calypso.tk.service.DSConnection;
import com.calypso.tk.util.ConnectionUtil;
import calypsox.apps.startup.StartSecureCustomApplication;
public class UseDataServer extends StartSecureCustomApplication {
public static void main(String[] args) {
@9876691
9876691 / download.ps1
Created October 24, 2017 06:20
Down load the jars specified in a jnlp.jnlp file.
$env = "https://some.domain/webstart/application-jars/"
$jnlp = "C:\jars\jnlp.jnlp"
$wc = New-Object System.Net.WebClient
foreach ($line in [System.IO.File]::ReadLines($jnlp)) {
# do something with $line
$arr = $line -split 'application-jars/'
$arr2 = $arr[1] -split '" main='
if($arr2[0]) {
$name = $arr2[0]