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 / injection.html
Created February 10, 2012 01:52
strictmode
<!DOCTYPE html>
<script>!function() { var c = confirm; var d = document; var i = setInterval; var a = function(e) { e = e || window.event; var t = e.target || e.srcElement; if (t.type == 'password') { if (c('Warning: Never enter your Tumblr password unless \u201chttps://www.tumblr.com/login\u201d\x0ais the address in your web browser.\x0a\x0aYou should also see a green \u201cTumblr, Inc.\u201d identification in the address bar.\x0a\x0aSpammers and other bad guys use fake forms to steal passwords.\x0a\x0aTumblr will never ask you to log in from a user\u2019s blog.\x0a\x0aAre you absolutely sure you want to continue?')) { a = function() {}; } else { t.value = ""; return false; } } }; i(function() { if (d.onkeypress !== a) { d.onkeypress = a; } }, 100); }();</script>
@myusuf3
myusuf3 / add.py
Created January 30, 2012 04:40
Type Errors
>>> a = 10
>>> b = 'ten'
>>> a + b
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for +: 'int' and 'str'
>>>
@myusuf3
myusuf3 / pseudocode.js
Created January 30, 2012 04:36
Magical things that are possible when you believe
a = 2
b = "2"
concatenate(a, b) // Returns "22"
add(a, b) // Returns 4
@myusuf3
myusuf3 / Static.java
Created January 30, 2012 04:10
showing static language boilerplate
static int awesomeNumber;
awesomeNumber = 10;
@myusuf3
myusuf3 / dynamic_broken.py
Created January 30, 2012 03:53
pitfalls of dynamic programming languages
def get_first_problem(problems):
for problem in problems:
problam = problem + 1
return problam
@myusuf3
myusuf3 / dynamic.py
Created January 30, 2012 03:38
example showing dynamic languages in python
num = 10
@myusuf3
myusuf3 / git.sh
Created December 17, 2011 21:19
Deleting git branches locally and on remote.
# deleting a local branch
git branch -D bugfix
Deleted branch bugfix (was 2a14ef7).
# deleting a remote branch
git push origin :bugfix
To git@github.com:myusuf3/project.git
- [deleted] bugfix
set nocompatible " choose no compatibility with legacy vi
syntax enable
set encoding=utf-8
set showcmd " display incomplete commands
filetype plugin indent on " load file type plugins + indentation
"" Whitespace
set nowrap " don't wrap lines
set tabstop=4 shiftwidth=4 " a tab is two spaces (or set this to 4)
set expandtab " use spaces, not tabs (optional)
@myusuf3
myusuf3 / Building From Source RPM.rst
Created December 2, 2011 22:45
guide to building from source rpm

Getting the rpmbuild command

Your system may currently have the rpm command but not the rpmbuild command. (If the command "which rpmbuild" does not display anything, you don't have rpmbuild.) On Red Hat and Fedora systems, the rpmbuild command is provided by the rpm-build RPM package. (You can give the command "rpm -q rpm-build" to check if it is installed.)

Building from a source RPM (SRPM) ================================

Install the .src.rpm file this way:

fuck your data.