This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
00000000004004f4 <main>: | |
4004f4: 55 push rbp | |
4004f5: 48 89 e5 mov rbp,rsp | |
4004f8: 48 83 ec 10 sub rsp,0x10 | |
4004fc: c7 45 fc 00 00 00 00 mov DWORD PTR [rbp-0x4],0x0 | |
400503: eb 0e jmp 400513 <main+0x1f> | |
400505: bf 0c 06 40 00 mov edi,0x40060c | |
40050a: e8 e1 fe ff ff call 4003f0 <puts@plt> | |
40050f: 83 45 fc 01 add DWORD PTR [rbp-0x4],0x1 | |
400513: 83 7d fc 09 cmp DWORD PTR [rbp-0x4],0x9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def shout(word="yes"): | |
return word.capitalize()+"!" | |
print shout() | |
# outputs : 'Yes!' | |
# As an object, you can assign the function to a variable like any | |
# other object | |
scream = shout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def getTalk(type="shout"): | |
# We define functions on the fly | |
def shout(word="yes"): | |
return word.capitalize()+"!" | |
def whisper(word="yes") : | |
return word.lower()+"..."; | |
# Then we return one of them |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
def decorator( fn ): | |
def wrapper( ): | |
print( "Befor the function is called" ) | |
fn( ) | |
print( "After the function is called" ) | |
return wrapper |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def draw_point(x, y): | |
# do some magic | |
point_foo = (3, 4) | |
point_bar = {'y': 3, 'x': 2} | |
draw_point(*point_foo) | |
draw_point(**point_bar) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3.2 | |
import itertools | |
print( list( itertools.permutations( [1, 2, 3, 4], 2) ) ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.data | |
hello: | |
.string "Hallo, Welt!\n" | |
.text | |
.global _start | |
_start: | |
movl $4, %eax /* write() */ | |
movl $1, %ebx /* 1 = stdout */ | |
movl $hello, %ecx /* Adresse von hello */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
g++ -o for for.cpp -std=c++0x -Wall |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <typename T> | |
T ConvertString( const std::string &data ) | |
{ | |
if( !data.empty( )) | |
{ | |
T ret; | |
std::istringstream iss( data ); | |
if( data.find( "0x" ) != std::string::npos ) | |
{ | |
iss >> std::hex >> ret; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gcc -Wall -o union union.c |
OlderNewer