Skip to content

Instantly share code, notes, and snippets.


Mohamad Safadieh msafadieh

Block or report user

Report or block msafadieh

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
msafadieh /
Created Mar 27, 2019
simulation of the Monty hall problem
a simulation of the Monty hall problem
from random import choice, sample
TRIALS = 10000
def monty():
runs a simulation of the monty problem. this program will switch
msafadieh / circles.rkt
Last active Mar 15, 2019
more cool racket graphics
View circles.rkt
#lang racket
(require 2htdp/image)
(require 2htdp/universe)
;; structure used
(struct crcl (radius color))
;; constants
(define SIZE 500)
msafadieh / stars.rkt
Last active Mar 14, 2019
cool racket graphics
View stars.rkt
#lang racket
(require 2htdp/image)
(require 2htdp/universe)
(define (polygons n)
(let* ([random-color (lambda () (color (random 255) (random 255) (random 255)))]
[random-polygon (lambda (x) (star-polygon (* (add1 x) 30) (random 12 16) 11 'solid (random-color)))]
[polygons-list (build-list n random-polygon)]
[background (square (* 150 n) 'solid (random-color))])
msafadieh /
Created Dec 18, 2018
python recursive directory search
#! /bin/python3
A little script that searches through folders for me and prints any files/dirs
that contain the query in the filename.
This is what happens when you don't really feel like going through the man of
the find command.
python3 [query] [path]
msafadieh /
Last active Jan 9, 2019
a small google sheets script written out of necessity
A small script I wrote to manipulate Google Sheets.
What this script does:
1. Opens a spreadsheet with two worksheets
2. Lays out the data of the second worksheet in a dict (the keys are street addresses
and the items are arrays)
3. Fetches cell range to manipulate
4. Iterates through the rows in the first sheet and looks in the generated dict for a
match (same street address)
5. If found, inserts the array content into the row.
You can’t perform that action at this time.