Skip to content

Instantly share code, notes, and snippets.

View orweinberger's full-sized avatar

Or Weinberger orweinberger

View GitHub Profile

Keybase proof

I hereby claim:

  • I am orweinberger on github.
  • I am orweinberger (https://keybase.io/orweinberger) on keybase.
  • I have a public key whose fingerprint is BAE5 9C9A AA7B A487 F99D 19EC AFE2 5EC6 4146 9280

To claim this, I am signing this object:

openssl req -new -sha256 -nodes -out your-new-domain.com.csr -newkey rsa:2048 -keyout your-new-domain.com.key -config <(
cat <<-EOF
[req]
default_bits = 2048
prompt = no
default_md = sha256
req_extensions = req_ext
distinguished_name = dn
[ dn ]
@orweinberger
orweinberger / kibana-dashboard.json
Last active February 13, 2022 07:17
Extract Gmail messages and insert into Elasticsearch
[
{
"_id": "Gmail-Dashboard",
"_type": "dashboard",
"_source": {
"title": "Gmail Dashboard",
"hits": 0,
"description": "",
"panelsJSON": "[{\"col\":1,\"id\":\"Top-10-Worst-senders\",\"row\":4,\"size_x\":2,\"size_y\":5,\"type\":\"visualization\"},{\"col\":3,\"id\":\"Emails-Date-Histogram\",\"row\":1,\"size_x\":10,\"size_y\":3,\"type\":\"visualization\"},{\"col\":3,\"id\":\"Top-10-Senders\",\"row\":4,\"size_x\":2,\"size_y\":5,\"type\":\"visualization\"},{\"col\":1,\"id\":\"Total-Messages\",\"row\":1,\"size_x\":2,\"size_y\":3,\"type\":\"visualization\"},{\"col\":10,\"id\":\"Day-Of-Week\",\"row\":4,\"size_x\":3,\"size_y\":5,\"type\":\"visualization\"},{\"id\":\"Hour-Of-Day\",\"type\":\"visualization\",\"size_x\":5,\"size_y\":5,\"col\":5,\"row\":4}]",
"version": 1,
@orweinberger
orweinberger / bitcoin-elasticsearch.js
Last active August 29, 2015 14:22
Unconfirmed txs to elastic
var WebSocket = require('ws');
var request = require('request');
var socket = new WebSocket("wss://ws.blockchain.info/inv");
socket.onopen = function (event) {
console.log('connected');
socket.send(JSON.stringify({"op": "unconfirmed_sub"}));
};
var last;
socket.onmessage = function (event) {
@orweinberger
orweinberger / index.html
Created June 9, 2015 19:26
Bitcoin socket
<html>
<head>
<script>
var socket = new WebSocket("wss://ws.blockchain.info/inv");
socket.onopen = function (event) {
console.log('connected');
socket.send(JSON.stringify({"op":"unconfirmed_sub"}));
};
socket.onmessage = function (event) {
var sum = 0;
@orweinberger
orweinberger / es.json
Last active August 29, 2015 14:21
Elasticsearch query examples
/* Simple query */
{
"query": {
"bool": {
"must": {
"match": {
"host": "10.168.233.28"
}
}
@orweinberger
orweinberger / final.js
Created January 8, 2015 15:24
Generate a raw transaction using bitcoinjs-lib
var bitcoin = require(‘bitcoinjs-lib’);
var key = bitcoin.ECKey.fromWIF("L1Kzcyy88LyckShYdvoLFg1FYpB5ce1JmTYtieHrhkN65GhVoq73");
var tx = new bitcoin.TransactionBuilder();
tx.addInput("d18e7106e5492baf8f3929d2d573d27d89277f3825d3836aa86ea1d843b5158b", 1);
tx.addOutput("12idKQBikRgRuZEbtxXQ4WFYB7Wa3hZzhT", 149000);
tx.sign(0, key);
console.log(tx.build().toHex());
tx.sign(0, key);
console.log(tx.build().toHex());
tx.addOutput("12idKQBikRgRuZEbtxXQ4WFYB7Wa3hZzhT", 149000); // 1000 satoshis will be taken as fee.
tx.addInput("d18e7106e5492baf8f3929d2d573d27d89277f3825d3836aa86ea1d843b5158b", 1);