Skip to content

Instantly share code, notes, and snippets.

Avatar

Or Weinberger orweinberger

View GitHub Profile
View keybase.md

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:

View gist:191b135a234c9c3ce27adcaad68e7ef5
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 Feb 13, 2022
Extract Gmail messages and insert into Elasticsearch
View kibana-dashboard.json
[
{
"_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 Aug 29, 2015
Unconfirmed txs to elastic
View bitcoin-elasticsearch.js
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) {
View index.html
<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 Aug 29, 2015
Elasticsearch query examples
View es.json
/* Simple query */
{
"query": {
"bool": {
"must": {
"match": {
"host": "10.168.233.28"
}
}
@orweinberger
orweinberger / final.js
Created Jan 8, 2015
Generate a raw transaction using bitcoinjs-lib
View final.js
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());
View step7.js
tx.sign(0, key);
console.log(tx.build().toHex());
View step6.js
tx.addOutput("12idKQBikRgRuZEbtxXQ4WFYB7Wa3hZzhT", 149000); // 1000 satoshis will be taken as fee.
View step5.js
tx.addInput("d18e7106e5492baf8f3929d2d573d27d89277f3825d3836aa86ea1d843b5158b", 1);