Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Mohamad Safadieh msafadieh

🎯
Focusing
  • Vassar College
  • Poughkeepsie, NY
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
View xmonad.hs
import XMonad hiding ( (|||) )
import XMonad.Actions.CycleWS
import XMonad.Util.EZConfig(additionalKeys)
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.EwmhDesktops
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.ManageHelpers
import XMonad.Layout.TwoPane
import XMonad.Layout.LayoutCombinators
import XMonad.Layout.NoBorders
View services.nix
{ config, pkgs, ... }:
{
systemd.services = {
"suspend@" = {
description = "i3lock";
before = [ "sleep.target" ];
environment = { DISPLAY = ":0"; };
serviceConfig = { Type = "forking"; User = "mhmd"; };
@msafadieh
msafadieh / wikisearch.js
Last active Sep 23, 2019
find shortest path from one wiki page to the other
View wikisearch.js
import axios from 'axios'
export async function findShortestPath(firstPage, secondPage, callback, parent) {
if (state === undefined) {
state = {}
state.done = false;
state.visited = {}
state.visited[firstPage] = true;
}
@msafadieh
msafadieh / namecheap.py
Created Sep 19, 2019
a very small client for Namecheap API that I needed for automation
View namecheap.py
from xml.etree import ElementTree as ET
import requests
NAMECHEAP_URL = "https://api.namecheap.com/xml.response"
class NamecheapClient:
def __init__(self, api_key, api_user, user_name, client_ip):
self.api_key = api_key
self.api_user = api_user
@msafadieh
msafadieh / fetch_printer.py
Created Sep 19, 2019
Checks the paper status of campus printers by IP
View fetch_printer.py
import json
import requests
import re
from sys import argv
status = {"0": "Empty", "1": "Low", "2": "Normal", "3": "Full"}
data = {
"uri":"/rps/",
"userID":"",
"password":""
@msafadieh
msafadieh / sheets2docs.gs
Last active Aug 21, 2019
Builds a barebone Google Doc from Google Sheet entries
View sheets2docs.gs
var folderName = "New Copy Center Jobs";
var columnsToSkip = 2;
function createDocument(lastRow) {
const doc = createDoc();
const sheet = SpreadsheetApp.getActiveSheet();
const fullRangeValues = sheet.getDataRange().getValues();
const titles = fullRangeValues[0];
@msafadieh
msafadieh / resume.tex
Last active Aug 20, 2019
Latex Resume
View resume.tex
\documentclass[fontsize=11pt]{article}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[protrusion=true,expansion=true]{microtype}
\usepackage[svgnames]{xcolor} % Colours by their 'svgnames'
\usepackage[margin=0.75in]{geometry}
\textheight=700px
\usepackage{url}
@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 Aug 23, 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))])
You can’t perform that action at this time.