Skip to content

Instantly share code, notes, and snippets.

View shelling's full-sized avatar

shelling shelling

View GitHub Profile
@shelling
shelling / pass-by-ref.scm
Created September 18, 2009 15:59
exam mutating parameters itself
;; SEE ALSO
;; http://stackoverflow.com/questions/1080328/append-in-scheme
(define foo '(hello world))
(append! foo '(bar))
(display foo)(newline)
(define my-append!
(lambda (a . b)
#include <stdio.h>
#include "mpi.h"
int main ( int argc, char *argv[] ) {
int numprocs;
int myid;
MPI_Init(&argc, &argv);
@shelling
shelling / vla.c
Created September 26, 2009 08:00
#include <stdio.h>
#include "my.h"
int main () {
int a;
scanf("%d", &a);
int array[ a ]; // C99's variable-length array
#include <stdio.h>
#include <stdarg.h>
#include <signal.h>
#include <string.h>
#include <stdlib.h>
//
// Please compile with this arg -std=c99 when using GCC 4.x.
// commenting with double slash and inline function are C99's feature
//
#include <stdio.h>
#include <tgmath.h>
// Fortunately, all three functions required in this assignment
// is one-liner...XD
static inline double speed_at_temperature( int temperature );
static inline void instructions( void );
static inline double TRUNC( double digits );
@shelling
shelling / simple
Created October 16, 2009 15:18
output picture in octave/matlab
x = -10:0.01:10;
plot(x, sin(x));
print -djpg first.jpg
@shelling
shelling / em_theory_assignment_2.rb
Created October 21, 2009 19:58
EM theory assignment 2
#!/usr/bin/env ruby
$:.unshift "./lib"
require 'em_wave'
require 'rubygems'
require 'mrplot'
require 'mrplot/magick'
require 'mrplot/plots/xy'
include MRPlot
#!/usr/bin/env python
import sys
sys.path.append("./lib")
from layer_helper import *
from pylab import *
from numpy import *
#!/usr/bin/env python
import matplotlib as mpl
mpl.use("Agg") # this must be called before imorting pylab
import pylab as pl
import numpy as np
from math import *
t = pl.arange(-10, 5, 0.001)
# Rename this file to setup.cfg to modify matplotlib's
# build options.
[egg_info]
tag_svn_revision = 1
[status]
# To suppress display of the dependencies and their versions
# at the top of the build log, uncomment the following line:
#suppress = True