Skip to content

Instantly share code, notes, and snippets.

View myusuf3's full-sized avatar
🏠
Working from home

Mahdi Yusuf myusuf3

🏠
Working from home
View GitHub Profile
@myusuf3
myusuf3 / apple.py
Last active September 20, 2017 13:49
script to check if apple site is up and running again.
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 August 29, 2015 14:16
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.
- banal-signup (user management)
- banal-payments (cash money)
- banal-betalist (beta list hype tools)
@myusuf3
myusuf3 / delete_git_submodule.md
Created November 3, 2014 17:36
How effectively delete a git submodule.

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
#!/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"
@myusuf3
myusuf3 / gist:5681305
Last active December 17, 2015 22:19 — forked from anonymous/gist:5681076
for k,v in propertyDict:
for k1,v2 in propertyDict[k]:
print('---' + k1 + '---' + propertyDict[k][k1])
# Then you can do things like, etc.
pip install -r requirements.txt -u prod
@myusuf3
myusuf3 / profile.py
Created April 23, 2013 07:01
Simple little profiling decorator in python.
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)
@myusuf3
myusuf3 / future.py
Created January 18, 2013 18:30
Braces
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 December 10, 2012 20:38
Code of Conduct: Open Source

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 / models.py
Created October 29, 2012 18:45
example of function resolution
from django.db import models
from datetime import datetime
class AwesomePeople(models.Model):
# this will always be the date the code was loaded.
date_create = models.DatetimeField(default=datetime.today())
name = models.CharField(max_length=100)