This file contains hidden or 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
| /* | |
| How to run | |
| $ javac Sheep.java && java Sheep -Xms1k -Xmx1k -XX:MaxPermSize=1k -XX:MaxNewSize=1k | |
| Sample output | |
| 양(id=35994) is created | |
| 양(id=35995) is created | |
| 양(id=35996) is created | |
| 양(id=17679) is killed, current alive 양 14956마리 | |
| 양(id=35997) is created |
This file contains hidden or 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/env python | |
| ''' | |
| [haruna@haruna test ]$ ./function_default_value_python.py | |
| 2015-11-24 11:16:47.815578 | |
| 2015-11-24 11:16:47.815578 | |
| same | |
| ''' |
This file contains hidden or 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
| /* | |
| javac -g A.java && java A | |
| */ | |
| class A { | |
| public A A() { | |
| A A = new A(); | |
| return A; | |
| } | |
| public static void main(String[] args) { |
This file contains hidden or 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
| /* | |
| Reference | |
| * http://en.cppreference.com/w/cpp/language/operator_alternative | |
| $ clang trigraphs.c | |
| */ | |
| %:include <stdio.h> | |
| %:include <stdbool.h> | |
| %:include <iso646.h> |
This file contains hidden or 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
| /* | |
| Calculate Average of "Hello, World!". | |
| $ clang++ hello_world.cpp -std=c++11 | |
| $ ./a.out | |
| Rello, aorld | |
| 82 101 108 108 111 44 32 97 111 114 108 100 22 3 0 | |
| */ | |
| #include <string> | |
| #include <cstdio> |
This file contains hidden or 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
| #include <stdio.h> | |
| #include <signal.h> | |
| #include <unistd.h> | |
| static int prev_fib = 0; | |
| static int curr_fib = 1; | |
| void sig_handler(int signo) | |
| { | |
| if (signo == SIGINT) { |
This file contains hidden or 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
| import os | |
| a = '/home/haruna/devel/libsora.so/content' | |
| b = '../static/sample' | |
| c = 'sidetail-sora.gif' | |
| print(os.path.join(a, b, c)) | |
| #/home/haruna/devel/libsora.so/content/../static/sample/sidetail-sora.gif | |
| a = '/home/sora/devel/libsora.so/content' | |
| b = '/static/sample' |
This file contains hidden or 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
| main: | |
| make current; \ | |
| make dystopia | |
| current: new_history_teaching.cpp | |
| rm -rf a.out | |
| clang++ $^ -W -Wall | |
| ./a.out | |
| dystopia: new_history_teaching.cpp |
This file contains hidden or 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
| CXX = clang++ | |
| CXX_FLAGS = -W -Wall -std=c++11 | |
| all: sample.o partial_a.o partial_b.o main.o | |
| clang++ $^ -o a.out $(CXX_FLAGS) | |
| run: all | |
| ./a.out | |
| sample.o: sample.cpp |
This file contains hidden or 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++ main.cpp -W -Wall | |
| ./a.out | |
| addr x : 7ffc853ffcf4 | |
| addr y : 7ffc853ffcf8 | |
| addr diff: -4 | |
| addr i : 7ffc853ffce4 | |
| addr array: 7ffc853ffcf0 | |
| curr addr : 7ffc853ffcf0 |