Skip to content

Instantly share code, notes, and snippets.

@CBasis
CBasis / data.csv
Created October 23, 2016 20:05 — forked from phoebebright/data.csv
D3 using nest on csv data
id name priority who time status
T-024 Organisation list in directory MUST Joe 5 Complete
T-015 Make term Commissions customisable MUST Natasha 6 Complete
T-016 Comments popup on select rates MUST Mike 3 In Progress
T-0169 Upgrade Centos Box MUST Joe 2 In Progress
T-013 Search in Documents on selected folder MUST Natasha 6 In Progress
T-014 Separate Document system for LA and Legals MUST Joe 9 In Progress
T-017 Demo of Look and Feel of Documents front end MUST Natasha 5 In Progress
T-021 Fix error where forum filename is greater than 100chars MUST Mike 4 Not Started
T-025 Fix admin so structure of categories displayed MUST Mike 2.5 Complete
curl -s -XPOST localhost:9200/_bulk?pretty=true --data-binary '
{ "index" : { "_index" : "parent_child", "_type" : "store", "_id" : "store1" } }
{ "name" : "auchan", "owner" : "chris" }
{ "index" : { "_index" : "parent_child", "_type" : "department", "_id" : "department1", "parent" : "store1" } }
{ "name" : "toys", "numberOfProducts" : 150 }
{ "index" : { "_index" : "parent_child", "_type" : "product", "_id" : "product1", "parent" : "department1", "routing" : "store1" } }
{ "name" : "gun", "trademark" : "tiger", "price" : 9, "store_id" : "store1" }
'
@CBasis
CBasis / command.sh
Last active August 29, 2015 14:06 — forked from felixge/command.sh
# Here a few bash one-liners that helped me analyze / fight a weak DOS attack against debuggable.com. Mostly for future reference.
# The attacker was opening lots of tcp connections without sending data, I believe it's called a SYN flood, see: http://tools.ietf.org/html/rfc4987#section-3.2
# Step 0: Check what is going on at port 80
$ netstat -tan | grep ':80 ' | awk '{print $6}' | sort | uniq -c
# Step 1: Increase the number of available fds
$ ulimit -n 32000
# Step 2: Restart your webserver, for me:
# -*- coding:utf-8 -*-
import json
import sqlite3
JSON_FILE = "some.json"
DB_FILE = "some.db"
traffic = json.load(open(JSON_FILE))
conn = sqlite3.connect(DB_FILE)
#!/usr/bin/env python
""" Script that prints out tomorrow's weather forecast, using the Yahoo Weather API.
You'll need to get your location's WOEID, which you can get from entering your
location in the form on http://weather.yahoo.com/ - currently where it says
'Enter city of zip code'.
The WOEID numerical id will be in the URL of the page you get redirected to
after submitting the form e.g. in the URL
http://weather.yahoo.com/united-kingdom/england/newcastle-upon-tyne-30079/ the
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.node circle {
fill: #fff;
stroke: steelblue;
stroke-width: 1.5px;
}

This example shows how it is possible to use a D3 sunburst visualization (partition layout) with data that describes sequences of events.

A good use case is to summarize navigation paths through a web site, as in the sample synthetic data file (visit_sequences.csv). The visualization makes it easy to understand visits that start directly on a product page (e.g. after landing there from a search engine), compared to visits where users arrive on the site's home page and navigate from there. Where a funnel lets you understand a single pre-selected path, this allows you to see all possible paths.

Features:

  • works with data that is in a CSV format (you don't need to pre-generate a hierarchical JSON file, unless your data file is very large)
  • interactive breadcrumb trail helps to emphasize the sequence, so that it is easy for a first-time user to understand what they are seeing
  • percentages are shown explicitly, to help overcome the distortion of the data that occurs wh
@CBasis
CBasis / .gitignore
Last active October 23, 2016 20:03 — forked from metmajer/README.md
sap-ui-cachebuster-info.json
extended_runnable_file.html
.*/extended_runnable_file.html
visual_ext_index.html
/webapp/visual_ext_index.html
UIAdaptation_index.html
changes_preview.js
fioriHtmlRunner.html
.*/fioriHtmlRunner.html