This is a collection of little snippets of code for OpenSCAD
roundness needs to be less than half the smallest dimension, otherwise you just get a sphere
// https://agweber.net/3d/snippets.html
module rcube(size=[25,25,25], roundness=5) {
  x = size[0]-roundness*2;
  y = size[1]-roundness*2;
  z = size[2]-roundness*2;
  translate([roundness, roundness, roundness]) minkowski() {
    cube([x,y,z]);
    sphere(r=roundness);
  }
}
r needs to be greater than roundness interesting faceting on the rounded edge due to a difference in number of faces from the sphere and
  cylinder. Set the $fn argument for both to the same value if you want a normal facetted edge.
add cylinder's center flag
// https://agweber.net/3d/snippets.html
module rcyl(r=20, h=50, roundness=5) {
  translate([0,0,roundness]) minkowski() {
    cylinder(r=r-roundness, h=h-roundness*2);
    sphere(r=roundness);
  }
}
A cylinder with a rounded top. Ideally, radius should be equal to roundness. Do what you want fam; lower radius, flatter top Add dome flags for top/bot/both
// https://agweber.net/3d/snippets.html
module pill(r=5, h=20, roundness=5) {
  s = r/roundness;
  translate([0,0,roundness]) hull() {
    scale([s,s,1]) sphere(r=roundness);
    translate([0,0,h-roundness*2]) scale([s,s,1]) sphere(r=roundness);
  }
}
This is an attempt at taking a torus out of a cylinder to provide a parabolic-walled cylinder This works nicely, but only if r2 is large enough. Still need to make this work for any value
// https://agweber.net/3d/snippets.html
module paracyl(r1=15, r2=5, h=20) {
  s = r2/(r1-r2);
  difference() {
    cylinder(r1=r1, r2=r2, h=h);
    color([.25,.5,.8,.4]) scale([s,s,1])
      translate([0,0,h]) rotate_extrude()
        translate([h+(r1-r2), 0, 0]) circle(r = h);
  }
}