Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

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
msafadieh / monty_hall_problem.py
Created Mar 27, 2019
simulation of the Monty hall problem
View monty_hall_problem.py
'''
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
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
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
msafadieh / find_query.py
Created Dec 18, 2018
python recursive directory search
View find_query.py
#! /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.
usage:
python3 find_query.py [query] [path]
@msafadieh
msafadieh / merge_sheets.py
Last active Jan 9, 2019
a small google sheets script written out of necessity
View merge_sheets.py
'''
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.