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> | |
void recur() { | |
printf("me: what's the topic, brearne: recursion"); | |
recur(); | |
} | |
int main() { recur(); } |
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 <stdlib.h> | |
struct pair { | |
int first, second; | |
}; | |
void printpair(const struct pair* apair) { | |
printf("first: %d, second: %d\n", apair->first, apair->second); | |
} |
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 <stdlib.h> | |
#define ADDRESSOF(X) &(X) | |
#define CONTENTSOF(X) *(X) | |
void swap(int* a, int* b) { | |
int temp = *a; | |
*a = *b; | |
*b = temp; |
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 <stdlib.h> | |
/* global variable - you should avoid these especially | |
* with parallel programming as they are hard to debug | |
*/ | |
int i = 42; | |
void printptr(void *ptr) { | |
/* prints the size of a pointer followed by its address. You |
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
#target: prereqs | |
# command | |
CFLAGS=-Wall -Werror -std=gnu99 | |
LDFLAGS=-lm | |
CC=gcc | |
SOURCES=fooimp.c something.c | |
HEADERS=fooimp.h | |
OBJS=fooimp.o something.o |
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
start,clear | |
store C | |
IF, LOAD A | |
skipcond 400 / skip next line if ac is 0 | |
jump mult | |
quit, load C | |
output | |
halt | |
mult, load C | |
ADD B |
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
for file in *.zip ; do | |
#remove the .zip extension from the file name | |
bfile=$(basename "$file" .zip) | |
#extract the band name. As the band name is the first part of the file, | |
#there might be trailing spaces so use sed to remove those | |
BAND=$(echo "$bfile" | cut -d- -f1 | sed 's/ $//'); | |
#the second part of the file name after the dash is the album name | |
#there might be spaces before / after the band name so use sed to | |
#remove those. | |
#in either case, spaces within the band or album name are left untouched. |
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 <iostream> | |
enum class weekdays { MON, TUE, WED, THU, FRI, SAT, SUN }; | |
const std::string daynames[] = {"monday", "tuesday", "wednesday", "thursday", | |
"friday", "saturday", "sunday"}; | |
#define WEEKLENGTH 7 | |
int main() { | |
for (int iter = 0; iter < WEEKLENGTH; iter++) { | |
std::cout << daynames[iter] << '\n'; | |
switch (weekdays(iter)) { |
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 | |
tease() { | |
echo "echo no, you can't do that" | |
echo "ha ha" | |
} | |
trap tease SEGV | |
trap tease INT | |
trap tease KILL |
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 <stdlib.h> | |
#include <unistd.h> | |
#define ERROR -1 | |
int main(int argc, char **argv) { | |
int ch; | |
int hasa = 0, hasb = 0, hasc = 0; | |
const char *barg = NULL; | |
while (ch = getopt(argc, argv, "ab:c"), ch != ERROR) { |