Skip to content

Instantly share code, notes, and snippets.

View exp0nge's full-sized avatar
👨‍💻
selective compiling...

MD Islam exp0nge

👨‍💻
selective compiling...
View GitHub Profile
@exp0nge
exp0nge / python3_mraa_upm
Last active April 18, 2017 03:54 — forked from gaiar/python3_mraa_upm
How to install Python 3 with libmraa and upm
GETTING FROM REPO [Broken]
# Adding repositories and installing required software
echo "src/gz all http://repo.opkg.net/edison/repo/all" >> /etc/opkg/base-feeds.conf && echo "src/gz edison http://repo.opkg.net/edison/repo/edison" >> /etc/opkg/base-feeds.conf && echo "src/gz core2-32 http://repo.opkg.net/edison/repo/core2-32" >> /etc/opkg/base-feeds.conf && opkg update
# Updating mraa and upm
opkg upgrade libmraa0 && opkg upgrade upm
@exp0nge
exp0nge / hcsr04_ultrasonic.py
Created February 19, 2017 03:05
hcsr04 with a fix for the stupid signal being frozen
# http://stackoverflow.com/questions/32300000/galileo-and-ultrasonic-error-when-distance-less-than-4cm
import mraa
import time
trig = mraa.Gpio(3)
echo = mraa.Gpio(4)
trig.dir(mraa.DIR_OUT)
echo.dir(mraa.DIR_IN)
<span class='reset' style='visibility: hidden;'>
Filter: <span class='filter'></span>
</span>
<a class='reset' href="#" style='visibility: hidden;'>reset</a>
$(document).ready(function () {
d3.json('data.json', function (data) {
var genderPieChart = dc.pieChart('#genderPie');
var marriagePieChart = dc.pieChart('#marriagePie');
var ageDefaultersChart = dc.barChart('#ageDefaulters');
var limitBalDefaultersChart = dc.lineChart('#limitBalDefaulters');
var defaultCountTicker = dc.numberDisplay('.default-count');
var ndx = crossfilter(data);
var defaultDim = ndx.dimension(function (d) {
return d['default payment next month'];
defaultCountTicker
.group(defaultDim.group())
.formatNumber(d3.format('')); //show the whole number
//again, get min/max for our x-axis
var limitBalMinMax = d3.extent(data, function (d) {
return d['LIMIT_BAL'];
});
limitBalDefaultersChart
.width(900)
.height(250)
.dimension(limitDefaultersDim)
.group(limitDefaultersDim.group().reduceSum(dc.pluck('default payment next month')))
//d3.extent will give us the min AND max, which makes it easy for us to setup a scale for our x-axis
var ageMinMax = d3.extent(data, function (d) {
return d['AGE'];
});
ageDefaultersChart
.width(900)
.height(250)
.dimension(ageDefaultersDim)
.group(ageDefaultersDim.group().reduceSum(dc.pluck('default payment next month'))) //this will choose the attribute for those that defaulted
marriagePieChart
.width(180)
.height(180)
.radius(80)
.dimension(marriageDim) //use the marriage dimension from earlier
.group(marriageDim.group());
marriagePieChart.controlsUseVisibility(true);
$('#marriagePie > a').on('click', function (e) {
marriagePieChart.filterAll();
dc.redrawAll();
//use our handler
genderPieChart
.width(180) //setup sizes
.height(180)
.radius(80)
.dimension(genderDim) //use the Crossfilter dimension we setup earlier
.group(genderDim.group()); //put this into the gender dimension group
genderPieChart.controlsUseVisibility(true); //tell the chart that we want to use anchor tags as resets
var genderPieChart = dc.pieChart('#genderPie');
var marriagePieChart = dc.pieChart('#marriagePie');
var ageDefaultersChart = dc.barChart('#ageDefaulters');
var limitBalDefaultersChart = dc.lineChart('#limitBalDefaulters');
var defaultCountTicker = dc.numberDisplay('.default-count');