Skip to content

Instantly share code, notes, and snippets.

@haganbt
haganbt / gist:2807272fb74a8a86e75c43960df3844e
Last active April 10, 2020 20:39
Node.js Rockset Example
"use strict";
const API_KEY = "****";
const COLLECTION_NAME = "myCollection";
const rockset = require("rockset").default(
API_KEY,
"https://api.rs2.usw2.rockset.com"
);
@haganbt
haganbt / pipeline.json
Created June 19, 2019 23:51
Elasticsearch ingest pipeline pushing data to another index
GET _cat/indices
# Create a pipeline that pushes the data to "index2"
PUT _ingest/pipeline/test
{
"description" : "Push data to index2",
"processors": [
{
"script": {
@haganbt
haganbt / README.md
Created May 13, 2018 21:09 — forked from saulshanabrook/README.md
Saving Web Crypto Keys using indexedDB

This is a working example on how to store CryptoKeys locally in your browser. We are able to save the objects, without serializing them. This means we can keep them not exportable (which might be more secure?? not sure what attack vectors this prevents).

To try out this example, first make sure you are in a browser that has support for async...await and indexedDB (latest chrome canary with chrome://flags "Enable Experimental Javascript" works). Load some page and copy and paste this code into the console. Then call encryptDataSaveKey(). This will create a private/public key pair and encrypted some random data with the private key. Then save both of them. Now reload the page, copy in the code, and run loadKeyDecryptData(). It will load the keys and encrypted data and decrypt it. You should see the same data logged both times.

{
"analysis": {
"freqDist": [
{
"ranger": "smith",
"threshold": 2,
"then": {
"type": "timeSeries",
"interval": "day"
},
@haganbt
haganbt / gist:4b3fda5229a25ee43c9d
Created March 3, 2015 18:30
Facebook Page Categories - 03032015
{
"Local Business or Place": {
"1111": "Cinema",
"1209": "Concert Venue",
"1305": "Bookshop",
"1306": "Library",
"1607": "Lawyer",
"1608": "Doctor",
"1900": "Restaurant/Café",
"2100": "Bar",
<?php
ini_set('memory_limit', '-1');
define('DATASIFT_USERNAME', '<DS_USERNAME>');
define('DATASIFT_APIKEY', '<DS_API_KEY>');
$csdl = file_get_contents('<MY_CSDL_FILE>');
compile(trim($csdl));
cluster.name: datasift
cloud:
aws:
access_key: ***************
secret_key: ************************
region: eu-west-1
discovery:
type: ec2
gateway:
type: s3
@haganbt
haganbt / gist:6447674
Created September 5, 2013 08:55
DataSift CSDL filter - tracking tweets from France in French
/*
* http://simple.wikipedia.org/wiki/List_of_cities_in_France
*
*/
(
// GEO
interaction.geo geo_polygon "51.08282186160978,2.548828125:50.816347765191075,2.63671875:50.68775800806201,2.900390625:50.78510168548186,3.131103515625:50.53088873891836,3.2794189453125:50.523904629228625,3.4716796875:50.31039245071915,3.71337890625:50.3454604086048,4.031982421875:50.257741984396894,4.2352294921875:50.13466432216696,4.1473388671875:50.06066538593667,4.229736328125:50.01832895590886,4.1473388671875:49.9759551873433,4.1473388671875:49.94061518401988,4.4769287109375:50.004208515595614,4.6746826171875:50.15930523913416,4.7735595703125:50.152266272562684,4.8834228515625:49.97242235423708,4.801025390625:49.85569332253434,4.8614501953125:49.75997752330658,5.0811767578125:49.710272582105695,5.16357421875:49.64273443429918,5.3338623046875:49.48240137826932,5.482177734375:49.55728898983402,5.745849609375:49.44670029695473,6.1083984375:49.468124067331644,6.4434814453125:49.35375571830993,6.580810546875:49.160154652338
<?php if(isset($nav) && !empty($nav)) echo $nav; ?>
@haganbt
haganbt / navigation.php
Created August 5, 2013 12:52
navigation.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Navigation {
var $menu = array(); //The array holding all navigation elements
var $out; // The HTML string to be returned
/*
* Render the top nav
*/