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 <iostream> | |
#include <memory> | |
struct A { | |
virtual void foo() const { | |
std::cout << "virtual A::foo()'s called" << std::endl; | |
} | |
}; | |
struct B { |
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 <cstdlib> | |
#include <cmath> | |
#include <ctime> | |
#include <algorithm> | |
#include <deque> | |
#include <iostream> | |
#include <iterator> | |
#include <limits> | |
#include <list> | |
#include <map> |
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/python | |
# Python 2->3 libraries that were renamed. | |
try: | |
from urllib2 import urlopen | |
except: | |
from urllib.request import urlopen | |
try: | |
from HTMLParser import HTMLParser | |
except: |
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
" All system-wide defaults are set in $VIMRUNTIME/debian.vim (usually just | |
" /usr/share/vim/vimcurrent/debian.vim) and sourced by the call to :runtime | |
" you can find below. If you wish to change any of those settings, you should | |
" do it in this file (/etc/vim/vimrc), since debian.vim will be overwritten | |
" everytime an upgrade of the vim packages is performed. It is recommended to | |
" make changes after sourcing debian.vim since it alters the value of the | |
" 'compatible' option. | |
" This line should not be removed as it ensures that various options are | |
" properly set to work with the Vim-related packages available in Debian. |
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> | |
char buf[32] = "Hello World"; | |
char *bufptr = buf; | |
void f(char **x) { | |
printf("%s\n", *x); | |
} | |
int main() { |
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 <omp.h> | |
int main(int argc, char *argv[]) | |
{ | |
char const quote[] = "The greatest enemy will hide in the last place you would ever look.\n"; | |
size_t const size = sizeof(quote); | |
#pragma omp parallel num_threads(2) | |
{ | |
for (size_t i = 0; i < size; ++i) { |
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
module type List = sig | |
type a | |
type t | |
val nil : t | |
val cons : a -> t -> t | |
val switch : (unit -> 'b) -> (a -> t -> 'b) -> t -> 'b | |
end | |
let to_string (type e) (type s) (module Impl : List with type a = e and type t = s) string_of_item l = | |
let rec inner ys = |
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 Data.List | |
ham :: [Integer] | |
ham = 1 : (map head . group $ merge (map (* 3) ham) (map (* 10) ham)) where | |
merge l1@(x : xs) l2@(y : ys) | x < y = x : merge xs l2 | |
| otherwise = y : merge l1 ys | |
main :: IO () | |
main = do | |
num' <- getLine |
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
bench: bench.o main.o | |
g++ $^ -o $@ | |
bench.o: bench.cpp | |
g++ -c -o $@ $^ | |
main.o: main.cpp | |
g++ -c -O3 -o $@ $^ |
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
Require Export SfLib. | |
Require Import Strings.String. | |
Require Import ZArith. | |
Module AExp. | |
Inductive aexp : Type := | |
| ANum : nat -> aexp | |
| APlus : aexp -> aexp -> aexp | |
| AMinus : aexp -> aexp -> aexp |