Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View dagrende's full-sized avatar

Dag Rende dagrende

  • Stockholm, Sweden
View GitHub Profile
Verifying my Blockstack ID is secured with the address 15bWtNMFcaj96pT5ZtH2FB4Nx6fyL5ERNf https://explorer.blockstack.org/address/15bWtNMFcaj96pT5ZtH2FB4Nx6fyL5ERNf
@dagrende
dagrende / coils.html
Last active September 6, 2017 05:48
draw brushless motor coil
<html>
<head>
<script src="http://d3js.org/d3.v3.min.js"></script>
</head>
<style>
svg {
background-color: #eee;
}
path {
stroke: black;
@dagrende
dagrende / obf.xsl
Created December 25, 2016 09:26
obfuscate anatomy file
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:variable name="fromchar" select="'abcdefghijklmnopqrstuvwABCDEFGHIJKLMNOPQRSTUVW0123456789'" />
<xsl:variable name="tochar" select="'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1111111111'" />
<xsl:output omit-xml-declaration="no"/>
<!-- copy unchanged by default -->
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
@dagrende
dagrende / README.md
Last active March 3, 2016 06:32
Render d3 node hierarchy from any data structure and a first layout manager sketch

The renderHierarchy function below, makes it easy to render any data structure as a hierarchy of svg elements. The example code renders the same nodes from two data structures that inpmements the same hierarchy - one natural hierarchy and one flat list where a parent attribute is used to define the hierarchy.

@dagrende
dagrende / index.html
Created February 27, 2016 19:48
create d3 element hierarchy from flat data
<!DOCTYPE html>
<meta charset="utf-8">
<style>
rect, circle {
fill: none;
stroke: black;
}
</style>
@dagrende
dagrende / index.html
Last active February 27, 2016 19:48
create d3 element hierarchy from hierarcic data
<!DOCTYPE html>
<meta charset="utf-8">
<style>
rect, circle {
fill: none;
stroke: black;
}
</style>
@dagrende
dagrende / model.jscd
Created November 14, 2015 18:51
train carousel
function main(params) {
return union(
CSG.cylinder({start:[0,-75,0], end:[0,-74,0], radius: 30, resolution:36}),
CSG.cylinder({start:[0,-83,0], end:[0,90,0], radius: 2, resolution:36}),
shifter().translate([0, -80, 0]),
ball_bearing().translate([0, -80.5, 0]),
ball_bearing().translate([0, 80.5, 0]),
ball_bearing().translate([0, 83.5, 0]),
ball_bearing().translate([0, -84.5, -10]),
CSG.cylinder({start:[0,-90,0], end:[0,-80,0], radius: 2, resolution:36}).translate([0, 0, -10]),