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
# Generate shell scripts for SGE. | |
def create_script(id, x, s, r, c, jpc): | |
f = open("job%(id_)d.sh" % {'id_' : id}, 'w') | |
f.write("#---------------------------Start program.job------------------------\n" \ | |
"#!/bin/bash\n" \ | |
"\n" \ | |
"# The name of the job, can be whatever makes sense to you\n" \ | |
"#$ -N phdp-c%(c_)dr%(r_).2f\n" \ | |
"\n" \ |
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
# Example with weave | |
# | |
# Required packages (linux): python-scipy, python-dev | |
# | |
# phdp@thinkpad:~$ python testweave.py | |
# 9784957257.9 | |
import numpy as np | |
from scipy.weave import inline |
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
package main | |
import ( | |
"fmt" | |
"io" | |
"os" | |
) | |
type Species struct { | |
Name string // Name of the species (dah!) |
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
// common.h | |
#ifndef COMMON_H_ | |
#define COMMON_H_ | |
#ifndef EAM_CONSTANT1 | |
#define EAM_CONSTANT1 0.5929439 | |
#endif | |
#ifndef EAM_VERSION |
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
// gcc assert.c -o assert | |
// gcc -DNDEBUG assert.c -o assert | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <assert.h> | |
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
// gcc main.c -o main | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <sys/types.h> | |
#include <sys/stat.h> | |
int main() | |
{ | |
mkdir("newdir", S_IRWXU); // S_IRWXU is the mode, it gives read/write/search access to the user. |
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
// Slow -> O(n). Return 1 if a node was removed, 0 otherwise. Untested :P | |
int isll_rm_tail(isll *l) | |
{ | |
if (l->head == NULL) | |
{ | |
return 0; | |
} | |
if (l->head == l->tail) | |
{ | |
return isll_rm_next(l, NULL); |
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
//: clang -Wall pause.c -o pause | |
#include <stdlib.h> | |
#include <stdio.h> | |
// Wait for the user to press enter to continue. | |
void pause(); | |
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 <stdlib.h> | |
#include <stdio.h> | |
int main() | |
{ | |
int a = 5; | |
int *b = &a; | |
printf(" a = %d\n", a); | |
printf(" &a = %p\n", &a); |
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
// clang folders.c -o folders | |
// Creating folders with system calls to mkdir | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <string.h> | |
int main() | |
{ | |
const int layer1 = 5; |
OlderNewer