Skip to content

Instantly share code, notes, and snippets.

runsun

Block or report user

Report or block runsun

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@runsun
runsun / monty.py
Created Mar 14, 2018
Monty Hall Problem Simulation
View monty.py
## Monty Hall Problem
## https://en.wikipedia.org/wiki/Monty_Hall_problem
##
## A simulation intended to prove the Monty Hall Solution wrong
## (that switching selection after one door is revealed increases
## the odd from 1/3 to 2/3), ended up proving it right.
##
## Result of running run(1000) 100 times: 0.67(+-)0.02
##
@runsun
runsun / get_openscad_funcs_for_doctest.py
Last active Jan 20, 2018
Print function names in the given .scad file and prepare them for doctest
View get_openscad_funcs_for_doctest.py
__description__ = "Print function names in the given .scad file and prepare them for doctest."
__author__= "Runsun Pan"
__version__= "180119-1"
'''
When an openSCAD file gets larger, it may contain too many functions and trying
to list them for doctest(https://bitbucket.org/runsun/doctest.scad), like:
[ //index_test( mode, opt ) // to-be-coded
, getdeci_test( mode, opt )
View web-audio-scheduler playing notes example
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>web-audio-scheduler playing notes example</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<script type="text/javascript">
@runsun
runsun / runscad.py
Created Sep 27, 2015
Run an openscad file once or n times and save shape output to file(s)
View runscad.py
##########################################################################
## runscad.py
##
## Run an openscad file once or n times and save shape output to file(s)
##
## by Runsun Pan (2015.9.25)
###########################################3##############################
import sys, os, re
narg = len(sys.argv)
@runsun
runsun / find.py
Last active Nov 16, 2017
Find lines where a word is located in all files under a folder.
View find.py
__description__ = "Find lines where a word is defined in a folder."
__version__= "171115-1"
__author__= "Runsun Pan"
'''
>>> py find.py -h
usage: find.py [-h] [--version] [-f folder] [-p prefix] [-a activeModule]
[-i includePrefix] [-x fileExt]
word
You can’t perform that action at this time.