Skip to content

Instantly share code, notes, and snippets.

View evidanary's full-sized avatar

evidanary evidanary

View GitHub Profile
@evidanary
evidanary / gist:d02d89c632530878163f256fe993d5a4
Created July 27, 2016 00:57
Export search history from chrome
// THis is for getting the search history on chrome
//Navigate to chrome://history/
//Search for "google.com/search/?q=" in the search box
function writeChromeHistoryToFile(fileName) {
coln = document.getElementsByTagName("a")
data = [].slice.call(coln).map((x) => x.href)
if(typeof data === "object"){
data = JSON.stringify(data, undefined, 4)
}
@evidanary
evidanary / promise_all.js
Created March 29, 2016 18:04
Demonstrating Promise.all
//Async load items from a remote API
loadItemsInStore(collection) {
this.setState({ isFetchingItemsFromRemote: true});
let promises = [];
for(let c of collection.values()) {
promises.push(ItemService.getItems(c.id));
}
let allPromises = Promise.all(promises);
//Fulfill the Promise
@evidanary
evidanary / 0_reuse_code.js
Created October 29, 2015 22:16
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@evidanary
evidanary / team_dashboard.html
Created December 19, 2014 08:14
Simple Javascript that cycles through multiple webpages. This can be displayed on a TV.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>Dashboard Example</title>
<style type="text/css">
body, html { margin: 0; padding: 0; width: 100%; height: 100%; overflow: hidden; }
iframe { border: none; width: 100%; height: 100%; display: none; }
iframe.active { display: block;}
</style>
<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
@evidanary
evidanary / basic.webgl.html
Last active August 29, 2015 14:09
Basic Webgl Starter code - OrbitControls with a WebGLRenderer
# Example of webgl rendered with orbitcontrols
<!DOCTYPE html>
<html lang="en">
<head>
<title>Vorcel</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<style>
body {
font-family: Monospace;
@evidanary
evidanary / gist:67fe12cb2bfeca21e2e4
Created August 20, 2014 17:43
ch-hadoop - a simple script to change where the hadoop configs point to on a machine
#!/bin/bash
# usage ch-hadoop production|qa
cd /Users/yranadive/hadoop/etc/hadoop
if [ $1 = 'production' ]
then
rm core-site.xml
rm hdfs-site.xml
rm mapred-site.xml
rm yarn-site.xml
@evidanary
evidanary / gist:47f55a5b7bcc559896f7
Created July 31, 2014 06:46
NerdTree and vim-rails .vimrc file for osx
execute pathogen#infect()
call pathogen#helptags()
filetype off
syntax on
filetype plugin indent on
map <C-n> :NERDTreeToggle<CR>
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif
@evidanary
evidanary / gist:593b6c3039545ab73f8f
Created July 17, 2014 18:33
Hive Last modification time of a table using webhdfs gem
irb> require 'webhdfs'
irb> client = WebHDFS::Client.new('hadoop-nn', 50070)
irb> fl = client.list('/user/hive/warehouse/database.db/tablename/')
irb> DateTime.strptime(fl.collect {|x| x['modificationTime']}.max.to_s, '%M')
@evidanary
evidanary / gist:9242371
Last active August 29, 2015 13:56
Thrift Monitoring for storm topologies. gen-rb folder has thrift generated ruby wrappers for talking to storm cluster
$:.push('/home/yranadive/gen-rb')
# This file monitors a set of storm topologies and generates
# 1. Zenoss friendly status message. e.g. topo1:1 topo2:0 (1=active, 0=inactive)
# 2. Mails the inactive topologies
# Usage: ruby storm_monitor.rb [mail]
# Optional argument "mail" on the command line will mail the report
require 'rubygems'
require 'thrift'
require 'nimbus'
@evidanary
evidanary / mixpanel_download_events.rb
Created February 24, 2014 22:27
This gets mixpanel JSON data and uploads to a table in HIVE
# Download Mixpanel Data
require '../lib/hive_utils.rb'
require 'yaml'
require 'fileutils'
require File.expand_path(File.dirname(__FILE__) + '/mixpanel_extract.rb')
# TODO use thor here to take the date from the commandline
def print_usage_and_exit
puts %q[Usage: