Skip to content

Instantly share code, notes, and snippets.

View norganna's full-sized avatar

Ken Allan norganna

View GitHub Profile
@norganna
norganna / README.md
Last active May 2, 2024 05:22
A slack bot to invite users from one channel to another.

Using:

Installing the script

Make a new directory and put the run.js script into it.

Run npm in that same directory to install the slack web-api module:

npm install @slack/web-api
@norganna
norganna / test-case.md
Last active February 6, 2020 04:57
TINYINT debezium/connect issue.

If I create a table:

CREATE TABLE test.Test (
    id int not null primary key auto_increment,
    a TINYINT(1) not null,
    b TINYINT(1),
    c TINYINT(2) not null,
    d TINYINT(2)
);
@norganna
norganna / subscribe.go
Created October 3, 2018 08:11
Example of subscribe after register.
package main
import (
"context"
"fmt"
"time"
"github.com/micro/go-micro"
"github.com/micro/protobuf/ptypes/wrappers"
)
@norganna
norganna / reject-reason.patch
Created April 23, 2018 02:30
Add rejection reason to go-ethereum EstimateGas
--- core/vm/interpreter.go (revision 744428cb03ea8de8f219708f57d2e197acb6689b)
+++ core/vm/interpreter.go (date 1524449729000)
@@ -102,7 +102,7 @@
//
// It's important to note that any errors returned by the interpreter should be
// considered a revert-and-consume-all-gas operation except for
-// errExecutionReverted which means revert-and-keep-gas-left.
+// ErrExecutionReverted which means revert-and-keep-gas-left.
func (in *Interpreter) Run(contract *Contract, input []byte) (ret []byte, err error) {
// Increment the call depth which is restricted to 1024
core@ piano~$ curl - L http: //10.36.5.64:4001/v2/stats/leader
{
"leader": "visual",
"followers": {
"front": {
"latency": {
"current": 0.460931,
"average": 0.5663465316657799,
"standardDeviation": 0.547781903505012,
"minimum": 0.18624,
// Weather update client
// Connects SUB socket to tcp://localhost:5556
#include "zhelpers.h"
int main (int argc, char *argv [])
{
// Socket to talk to server
printf ("Collecting updates from weather server…\n");
void *context = zmq_ctx_new ();
<?php
/*
* Weather update client
* Connects SUB socket to tcp://localhost:5556
* Collects weather updates and finds avg temp in zipcode
* @author Ian Barber <ian(dot)barber(at)gmail(dot)com>
*/
$context = new ZMQContext();
@norganna
norganna / mongo_connect.php
Last active December 22, 2015 15:18
Mongo connection script example for replicaset connection and reconnect on failure (without having to restart server).
<?php
$retry = 0;
$m = false;
// Repeat while no connection and haven't tried 3 times
while (!$m and $retry < 3) {
try {
// Connect to replica set
$m = new MongoClient("mongodb://10.0.1.100,10.0.1.101,10.0.5.1", [
@norganna
norganna / header_spy.js
Last active December 14, 2015 12:48
A header spy for mongo, to intercept and store headers during the request, which can later be retrieved during a publish() handler.
!function() {
var storage = {};
// Install a ghost listener so we can spy on the client headers.
function install_spy() {
// Surplant the current request and upgrade listeners.
_.each(['request', 'upgrade'], function (event) {
var app = __meteor_bootstrap__.app;
var old_listeners = app.listeners(event).slice(0);
app.removeAllListeners(event);
@norganna
norganna / spiderable.js.diff
Created November 17, 2012 15:26
spiderable patch to reattach hash fragment
--- spiderable.js.orig 2012-11-18 01:14:08.000000000 +1000
+++ spiderable.js 2012-11-18 01:16:08.000000000 +1000
@@ -14,10 +14,11 @@
var preQuery = req.url.substr(0, idx);
var queryStr = req.url.substr(idx + 1);
var parsed = querystring.parse(queryStr);
+ var fragment = '#!' + parsed['_escaped_fragment_'];
delete parsed['_escaped_fragment_'];
var newQuery = querystring.stringify(parsed);
var newPath = preQuery + (newQuery ? "?" + newQuery : "");