Skip to content

Instantly share code, notes, and snippets.

@tidwall
tidwall / example.js
Last active June 14, 2018 20:32
Connect to a live geofence in Tile38 using Node.js
openFence(9851, "localhost",
["NEARBY", "fleet", "FENCE", "POINT", "33", "-115", "1000"],
function(message){
console.log(message)
},
function(err){
console.log(err)
},
function(){
console.log("closed")
@tidwall
tidwall / whos-on-first.md
Last active October 24, 2016 21:45
Who's On First

Testing Tile38 Memory Usage

After Loading all data

> SERVER  
{
  "ok":true,
  "stats": {
    "aof_size":546724831,
@tidwall
tidwall / clone-bytes.go
Created September 15, 2016 16:47
Redcon example using bytes
package main
import (
"log"
"strings"
"sync"
"github.com/tidwall/redcon"
)
package gjson
import (
"encoding/json"
"testing"
"github.com/buger/jsonparser"
"github.com/tidwall/gjson"
)
@tidwall
tidwall / WebSocket.swift
Created July 26, 2016 23:55
import Compression
/*
* SwiftWebSocket (websocket.swift)
*
* Copyright (C) Josh Baker. All Rights Reserved.
* Contact: @tidwall, joshbaker77@gmail.com
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*
*/
@tidwall
tidwall / main.go
Last active July 8, 2016 12:15
Tile38 + Redigo
package main
import (
"flag"
"fmt"
"log"
"time"
"github.com/garyburd/redigo/redis"
)
@tidwall
tidwall / iteration_test.go
Created May 31, 2016 02:10
google/btree iteration benchmark
package btree
import (
"sort"
"testing"
)
type byInts []Item
func (a byInts) Len() int {
@tidwall
tidwall / 3000000.sh
Last active May 25, 2016 20:38
Tile38 3,000,000 nearby test
# Pull the latest tile38/master branch.
# Start Tile38 server in dev mode and very verbose.
./tile38-server -dev -vv
# From another terminal run use the CLI to insert 3,000,000 random points around the Silicon Valley area.
# This will create a collection key "mi:0" with points ids "0" - "2999999".
./tile38-cli massinsert 1 3000000 37.10776 -122.67145 38.19502 -121.62775
# Update location for point id "1001".
@tidwall
tidwall / git-status.sh
Last active January 26, 2016 21:12
Simple git status for subdirectories.
#!/bin/bash
set -e
cd $(dirname "${BASH_SOURCE[0]}")
for d in */ ; do
if [ -d "$d/.git" ]; then
cd "$d"
status=$(git status)
n=$(basename "`pwd`");
if [[ $status == *"working directory clean"* ]]; then
printf "%-20s\x1b[32mCLEAN\x1b[0m\n" $n
@tidwall
tidwall / goswitch
Last active January 23, 2016 16:13
Switch Go version from command line.
#!/bin/bash
# goswitch is a command line tool for quickly switching Go version.
## Usage
# Switch to go1.6beta1:
# $ goswitch 1.6beta1
# Switch to go1.5.2
# $ goswitch 1.5.2
# List available versions