Skip to content

Instantly share code, notes, and snippets.

@celsoagra
celsoagra / wallet.py
Created December 27, 2021 04:01
Wallet in python language
import hashlib,binascii,codecs,base58,ecdsa
class Wallet(object):
def __init__(self):
"""
private key
public key
address
https://github.com/burakcanekici/BitcoinAddressGenerator
https://medium.com/coinmonks/bitcoin-address-generation-on-python-e267df5ff3a3
import socket
import threading
class ThreadedServer(object):
def __init__(self, host, port):
self.host = host
self.port = port
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
self.sock.bind((self.host, self.port))
"""
A simple Blockchain in Python
"""
import hashlib
class GeekCoinBlock:
def __init__(self, previous_block_hash, transaction_list):
@celsoagra
celsoagra / GenerateKeypair.java
Last active November 30, 2021 11:28
code about to generate bitcoin address
package org.example.keypair;
import org.bitcoinj.core.Base58;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.bouncycastle.util.encoders.Hex;
import org.bouncycastle.util.io.pem.PemObject;
import org.bouncycastle.util.io.pem.PemReader;
import org.bouncycastle.util.io.pem.PemWriter;
import java.io.File;
mvn archetype:generate -DgroupId={project-packaging} -DartifactId={project-name} -DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=false
@celsoagra
celsoagra / app.js
Last active January 29, 2019 23:42
Example of JSTree
$(function () {
var data = [
{ "id" : "ajson1", "parent" : "#", "text" : "Simple root node" },
{ "id" : "ajson2", "parent" : "#", "text" : "Root node 2" },
{ "id" : "ajson3", "parent" : "ajson2", "text" : "Child 1" },
{ "id" : "ajson4", "parent" : "ajson2", "text" : "Child 2" },
];
$("#jstree").jstree({
"core" : {
@celsoagra
celsoagra / docker.elk.sh
Last active January 26, 2019 16:21
Iniciando a pilha do ELK (docker)
docker run -d --name elastic -d --name elasticsearch -p 9200:9200 -p 9300:9300 -e "xpack.security.enabled=true" -e "discovery.type=single-node" elasticsearch:6.5.0
docker run -d --name kibana -p 5601:5601 --link elasticsearch:elasticsearch -e "ELASTICSEARCH_URL=http://elasticsearch:9200" -e "XPACK_SECURITY_ENABLED=true" -e "ELASTICSEARCH_USERNAME=elastic" -e "ELASTICSEARCH_PASSWD=changeme" -e XPACK_GRAPH_ENABLED=true -e XPACK_WATCHER_ENABLED=true -e XPACK_ML_ENABLED=true -e XPACK_MONITORING_ENABLED=true -e XPACK_MONITORING_UI_CONTAINER_ELASTICSEARCH_ENABLED kibana:6.4.1
docker run -d --name logstash --link elasticsearch:elasticsearch -e "XPACK.MONITORING.ELASTICSEARCH.URL=http://elasticsearch:9200" logstash:6.5.1
docker run -d --name elastichq --link elasticsearch:elasticsearch -p 5000:5000 elastichq/elasticsearch-hq:release-v3.5.0
curl -s -H "Content-Type: application/json" -XPOST http://localhost:9200/info/info/1 -d @fakedata.json
@celsoagra
celsoagra / Vagrantfile
Last active October 9, 2018 03:29
Consul Installation
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# Servidor do Gestão DB
config.vm.define "consul" do |consul|
@celsoagra
celsoagra / get_keycloak_access_token.sh
Created September 29, 2018 12:39 — forked from adixchen/get_keycloak_access_token.sh
Get Keycloak access token via curl and pretty print it with python
curl \
-d "client_id=myclient" \
-d "client_secret=40cc097b-2a57-4c17-b36a-8fdf3fc2d578" \
-d "username=user" \
-d "password=password" \
-d "grant_type=password" \
"http://localhost:8080/auth/realms/master/protocol/openid-connect/token"
@celsoagra
celsoagra / index.html
Created September 21, 2018 18:50
AngularJS Stopwatch
<html ng-app="App">
<head>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.12/angular.js"></script>
<script src="//angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.10.0.js"></script>
<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
</head>
<body ng-controller="MainCtrl">
<stopwatch title="Stopwatch #1" time="sharedTime"></stopwatch>
<div stopwatch title="Stopwatch #2" time="sharedTime"></div>
<hr />