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
#include <stdio.h> | |
#include <unistd.h> | |
int main(int argc, char *argv[]) { | |
printf("Hello, "); | |
fork(); | |
printf(" World!\n"); | |
return 0; | |
} |
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
#include <cstdio> | |
using namespace std; | |
class A { | |
public: | |
int fa; | |
}; | |
class B : public A { |
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
#include <cstdio> | |
#include <inttypes.h> | |
using namespace std; | |
class Left { | |
int32_t a, b; | |
}; | |
class Right { |
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
#!/bin/bash | |
T='#!/bin/bash | |
Q=$(printf "\x27") # A literal single quote | |
echo "$T" | head -n2 - | |
echo T=$Q"$T"$Q | |
echo "$T" | tail -n6 -' |
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
#!/bin/sh | |
cat "$0" |
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
#include <stdio.h> | |
#include <sys/time.h> | |
#include <time.h> | |
#include <unistd.h> | |
/* How many times per second do we want the code to run? */ | |
const int frequency = 2; | |
/* Pretend to do something useful. */ | |
void do_work() { |
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
#include <pthread.h> | |
#include <stdio.h> | |
void philosopher1(pthread_mutex_t chopsticks[]) { | |
pthread_mutex_lock(&chopsticks[0]); | |
pthread_mutex_lock(&chopsticks[1]); | |
printf("Philosopher 1 is full.\n"); | |
pthread_mutex_unlock(&chopsticks[0]); | |
pthread_mutex_unlock(&chopsticks[1]); | |
} |
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
#include <stdio.h> | |
int fib(int n) { | |
int f1 = fib(n - 1); | |
int f2 = fib(n - 2); | |
if (n <= 2) | |
return 1; | |
return f1 + f2; | |
} |
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
module Main where | |
import Control.Concurrent | |
import Control.Exception | |
import Control.Monad | |
import qualified Data.ByteString as BS | |
import Network.Socket hiding ( recv ) | |
import Network.Socket.ByteString ( recv ) | |
import Text.Printf ( printf ) |
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
#!/bin/bash | |
set -e | |
classes_full=$(find . -name '*.java') | |
classes="" | |
for c in ${classes_full}; do | |
classes="${classes} $(basename $c .java)" | |
done |