Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Mahdi Yusuf myusuf3

🏠
Working from home
View GitHub Profile
@myusuf3
myusuf3 / apple.py
Last active Sep 20, 2017
script to check if apple site is up and running again.
View apple.py
from lxml import etree, html
import time
import requests
def main():
response = requests.get('https://store.apple.com/ca/')
body = response.text
@myusuf3
myusuf3 / banal-apps.txt
Last active Aug 29, 2015
Merely gathering up a list of apps that people are tired of rolling their own constantly. I would love to hear what you guys would want built out once and for all.
View banal-apps.txt
- banal-signup (user management)
- banal-payments (cash money)
- banal-betalist (beta list hype tools)
@myusuf3
myusuf3 / delete_git_submodule.md
Created Nov 3, 2014
How effectively delete a git submodule.
View delete_git_submodule.md

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
View sauce_connect_setup.sh
#!/bin/bash
# Curl and run this script as part of your .travis.yml before_script section:
# before_script:
# - curl https://gist.github.com/santiycr/5139565/raw/sauce_connect_setup.sh | bash
CONNECT_URL="http://saucelabs.com/downloads/Sauce-Connect-latest.zip"
CONNECT_DIR="/tmp/sauce-connect-$RANDOM"
CONNECT_DOWNLOAD="Sauce_Connect.zip"
READY_FILE="connect-ready-$RANDOM"
View gist:5681305
for k,v in propertyDict:
for k1,v2 in propertyDict[k]:
print('---' + k1 + '---' + propertyDict[k][k1])
View install.sh
# Then you can do things like, etc.
pip install -r requirements.txt -u prod
@myusuf3
myusuf3 / profile.py
Created Apr 23, 2013
Simple little profiling decorator in python.
View profile.py
import cProfile
def profile_this(fn):
def profiled_fn(*args, **kwargs):
# name for profile dump
fpath = fn.__name__ + '.profile'
prof = cProfile.Profile()
ret = prof.runcall(fn, *args, **kwargs)
prof.dump_stats(fpath)
View future.py
Python 2.7.2 (default, Jun 20 2012, 16:23:33)
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from __future__ import braces
File "<stdin>", line 1
SyntaxError: not a chance
@myusuf3
myusuf3 / rant.md
Created Dec 10, 2012
Code of Conduct: Open Source
View rant.md

I am writing this mostly out of frustration with developers. Hopefully this can shine some rules of conduct when discussing software on a medium like Github.

Being a developer, I understand that there are many things combating beautifully crafted software but thats the beauty of open source:

- Your time. 
- Your release dates. 
- Your requirements.

Another beauty of open source is collaboration and collective effort to craft better software .

@myusuf3
myusuf3 / scraper.py
Created Nov 7, 2012
get image from url
View scraper.py
# The contents of this file are subject to the Common Public Attribution
# License Version 1.0. (the "License"); you may not use this file except in
# compliance with the License. You may obtain a copy of the License at
# http://code.reddit.com/LICENSE. The License is based on the Mozilla Public
# License Version 1.1, but Sections 14 and 15 have been added to cover use of
# software over a computer network and provide for limited attribution for the
# Original Developer. In addition, Exhibit A has been modified to be consistent
# with Exhibit B.
#
# Software distributed under the License is distributed on an "AS IS" basis,
You can’t perform that action at this time.