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
| from wsgiref.util import setup_testing_defaults | |
| from wsgiref.simple_server import make_server | |
| import os | |
| def callXemark(): | |
| return os.popen("./xemark < example.xe").read() | |
| def xemarkapp(environ, start_response): | |
| status = '200 OK' |
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 java.util.List; | |
| import java.util.ArrayList; | |
| import java.util.Collection; | |
| public class ListReference{ | |
| public static int id = 0; | |
| protected static class MyLittleObject{ | |
| public int val; | |
| public MyLittleObject(){this.val=ListReference.id; ListReference.id +=1; } |
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
| #!/bin/bash | |
| #Script to change background image randomly when switching workspaces | |
| #image directories: | |
| dbus-monitor --profile "path='/org/mate/panel/applet/WindowListApplet/1'" | | |
| while read -r msg; do | |
| #echo $msg |
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 * chorus = "For he's a jolly good fellow"; | |
| char * ending = "Which no body can deny"; | |
| main(){ | |
| int i; | |
| for(i=0; i < 3; ++i){ | |
| printf("%s\n",chorus); | |
| sleep(1); |
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 <limits.h> //CHAR_BIT is defined in limits.h | |
| /*Bit Shifting Exercises */ | |
| /* getbits: get n bits from position p*/ | |
| unsigned getbits(unsigned x, int p, int n){ | |
| return (x >> (p+1-n)) & ~(~0 << n); | |
| /*Explanation: | |
| (p+1-n) gets you the number of bits you'll have to shift off to move the n bits at position p to the rightmost position |
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
| //This next variable could be declared in a seperate file if you wanted to. Not neccesary, its just a global | |
| unsigned long int next; | |
| int rand(void){ | |
| //extern because I like to be explicit about my constants | |
| extern unsigned long int next; | |
| next = next * 1103515245 + 12345; | |
| return (unsigned int)(next/65536) % 32768; | |
| } |
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> | |
| /* | |
| Fun Fact: | |
| Using an unsigned integer causes integer arithmetic module 2^n where n is the number of bits in the type | |
| */ | |
| main(){ | |
| unsigned char mod256; | |
| mod256 = 16*18; |
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> | |
| /* | |
| Write a program to fold long input lines into two or more shorter lines after the last non-blank character that occurs before the n-th column of input. Make sure your program does something intelligent with very long lines, and if there are no blanks or tabs before the specified column. | |
| */ | |
| #define COLUMN_WIDTH 80 | |
| #define MAX_LINE 1000 | |
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> | |
| /* Write a program to remove all comments from a C program, | |
| Don't forget to handle quoted strings and character constants | |
| properly. C Comments do not nest */ | |
| main(){ | |
| int first,second ,eatChar,lookAhead,previous; | |
| first = getchar(); | |
| while((second = getchar()) != EOF){ |
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> | |
| #define MAXLENGTH 1000 | |
| //Write a function reverse(s) that reverses the character string s. Use it to write a program that reverses its input line by line | |
| void reverse(char s[], int lim){ | |
| int i,j; | |
| j=lim-1; | |
| i=0; |