Skip to content

Instantly share code, notes, and snippets.

# Visualization of particles with gravity
# Adapted from pyopencl example
# Source: http://enja.org/2010/08/27/adventures-in-opencl-part-2-particles-with-opengl/
# Changelog: playing around with OO structures--nothing big
import pyopencl as cl # OpenCL - GPU computing interface
mf = cl.mem_flags
from pyopencl.tools import get_gl_sharing_context_properties
from OpenGL.GL import * # OpenGL - GPU rendering interface
# Visualization of particles with gravity
# Adapted from pyopencl example
# Source: http://enja.org/2010/08/27/adventures-in-opencl-part-2-particles-with-opengl/
#
# Refactoring example to show shader usage:
# Uses the x-ray shader found in MeshLab
# Code is a modified version of http://www.pygame.org/wiki/GLSLExample
#
# OpenCL support
@kbrafford
kbrafford / Glasses, pitcher, ashtray and dice (POV-Ray)
Created January 6, 2015 00:30
Altered POVRay file for 4K rendering of "Glasses, pitcher, ashtray and dice"
//-----------------------------------------
// Demo scene for various glass and kitchen props
// -----------------------------------------
// 4 types of glasses with 2 levels of liquid
// an ashtray, a pitcher and some dice
// All meshes modeled with Rhino except the dice that were
// modeled in Cinema 4D.
// -----------------------------------------
// Made for Persistence of vision 3.6
//==========================================
'''
EmbeddedExcellence.Formatting package
efloat module
Keith Brafford
Copyright (c) 2010 Embedded Excellence, Inc.
All Rights Reserved
'''
import math
>>> for p in (3,6,9):
... EFloat.precision = p
... for f in (math.pi, 12, 823, 1024, 1024**2, 1024**3):
... print EFloat(f), 1/EFloat(f)
...
3.142e+00 318.310e-03
12.000e+00 83.333e-03
823.000e+00 1.215e-03
1.024e+03 976.562e-06
1.049e+06 953.674e-09
Number of platforms: 2
Platform Profile: FULL_PROFILE
Platform Version: OpenCL 2.0 AMD-APP (2236.10)
Platform Name: AMD Accelerated Parallel Processing
Platform Vendor: Advanced Micro Devices, Inc.
Platform Extensions: cl_khr_icd cl_khr_d3d10_sharing cl_khr_d3d11_sharing cl_khr_dx9_media_sharing cl_amd_event_callback cl_amd_offline_devices
Platform Profile: FULL_PROFILE
Platform Version: OpenCL 1.2
Platform Name: Intel(R) OpenCL
Platform Vendor: Intel(R) Corporation
Day 6
======
Someone did a cool version using the `click` package. click is cool...learn it. better than argparse
Day 7
======
captncraig
----------
* just xlate to graphviz and you can also do it in the browser:
- https://pastebin.com/raw/1xQeA1AH
# uuid.py
#
# Create a Bluetooth LE service UUID, formatted for use with Nordic's SDK
#
# Keith Brafford (2019 Sep 24)
import click
import requests
import re
import sys
from random import uniform, seed
from math import sqrt
from multiprocessing import Pool, freeze_support
def f(count):
seed()
CIRCLES = ((10,10),(-10,10),(-10,-10), (10,-10))
tot_count, in_count = 0, 0
{
"Alabama": [
"Autauga County",
"Baldwin County",
"Barbour County",
"Bibb County",
"Blount County",
"Bullock County",
"Butler County",
"Calhoun County",