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 / horrid.py
Created October 29, 2012 15:40
something funny I and a couple of guys at work hacked up.
from datetime import datetime
def dont_serialize():
haha = [datetime.today, 'date']
first_function = None
for d in haha:
if not first_function:
first_function = d()
else:
@myusuf3
myusuf3 / wtf.py
Created October 13, 2012 22:29
error for running tests with make tests
flake8 compressor --ignore=E501,E128
coverage run --branch --source=compressor `which django-admin.py` test --settings=compressor.test_settings compressor
Coverage.py warning: No data was collected.
Traceback (most recent call last):
File "/home/myusuf3/.virtualenvs/compressor/bin/django-admin.py", line 5, in <module>
management.execute_from_command_line()
File "/home/myusuf3/.virtualenvs/compressor/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 443, in execute_from_command_line
utility.execute()
File "/home/myusuf3/.virtualenvs/compressor/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 382, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
#! /bin/bash
INRES="1920x1080" # input resolution
#OUTRES="1024x640" # Output resolution
OUTRES="1920x1080" # Output resolution
FPS="30" # target FPS
# Write your key in a file named .twitch_key in your home directory
STREAM_KEY=$(cat ~/.twitch_key) # This is your streamkey generated by jtv/twitch found at: http://www.justin.tv/broadcast/adv_other
@myusuf3
myusuf3 / sublime.json
Created September 8, 2012 16:58
sublime text settings
{
"auto_complete_commit_on_tab": true,
"close_windows_when_empty": false,
"color_scheme": "Packages/Color Scheme - Default/Twilight.tmTheme",
"draw_white_space": "all",
"find_selected_text": true,
"fold_buttons": false,
"folder_exclude_patterns":
[
".svn",
@myusuf3
myusuf3 / OAuth.md
Created July 24, 2012 15:53
OAuth and API Providers: Come on guys.

The more OAuth providers there are, the more inconsistency there is. Not following the specification puts an increased and unnecessary burden on the developer.

In the past couple of weeks I have coordinated and authenticated with more than my fair share of OAuth providers. That being said, you should be thinking "Hey, isn't OAuth a specification?" Once you do one you should be simply swapping out keys and urls and you should be good to go right? So wrong.

Follow the specification and be consistent.

This article is meant to let the OAuth providers know some of the pain points of dealing with them as providers and steps they could take to make interacting with their API a joy.

API Documentation

@myusuf3
myusuf3 / OAuth.md
Created July 24, 2012 14:46 — forked from mgrouchy/OAuth.md
OAuth and API Providers: Come on guys.

The more OAuth providers there are, the more inconsistency there is. Not following the specification puts an increased and unnecessary burden on the developer.

In the past couple of weeks I have coordinated and authenticated with more than my fair share of OAuth providers. That being said, you should be thinking "Hey, isn't OAuth a specification?" Once you do one you should be simply swapping out keys and urls and you should be good to go right? So wrong.

Follow the specification and be consistent.

This article is meant to let the OAuth providers know some of the pain points of dealing with them as providers and steps they could take to make interacting with their API a joy.

API Documentation

#
# Cookbook Name:: sourcemetrics
# Recipe:: default
#
# Copyright 2012, swixhq.com
#
# All rights reserved - Do Not Redistribute
#
node[:users].each_pair do |username, info|
@myusuf3
myusuf3 / hosts files
Created May 16, 2012 21:05
for your reference.
Format:
<IP> <HOSTNAME>.<DOMAIN> <ALIAS>
Example:
127.0.0.1 localhost.localdomain localhost
@myusuf3
myusuf3 / dual screen osx clamshell
Created March 20, 2012 00:23
how to disable desktop monitor
Some MacBook Pro or Air users may want to disable their internal screen when the laptop is connected to an external display, this is generally achieved in two ways but since Mac OS X 10.7 the internal screen is more persistent and wants to stay on.
To disable the internal screen for OS X Lion based laptops, launch the Terminal and enter the following command:
sudo nvram boot-args="iog=0x0"
You’ll need to reboot for changes to take effect, and the internal display will then be completely disabled regardless of whether the Mac is open or closed.
To undo this, you can go back to the Terminal and enter:
@myusuf3
myusuf3 / setup.py
Created February 11, 2012 19:36
hello
from distutils.core import setup
setup(
name='hello',
version='0.1dev',
description='hhi',
url='https://github.com/myusuf3/hello',
author='Mahdi Yusuf',