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
#!/usr/bin/env python | |
''' create an .epub file from a given directory ''' | |
import os, sys, zipfile | |
import Tkinter, tkFileDialog | |
def zipdir(zipf, path): | |
''' add everything under path under zipf ''' | |
for root, dirs, files in os.walk(path): |
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 <stdlib.h> | |
#include <time.h> | |
/* generate a random permutation of array `a` in place */ | |
static void randperm(int n, double *a) | |
{ | |
int i, j; | |
double x; |
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
double _[]={42060394849482.6,6.289356622075972e33,600};main(){(*_*=2,_[1]/=2,--_[2])?main():puts((char*)_);} |
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
#!/usr/bin/env python | |
''' get numbers from text pasted from PDF file ''' | |
from math import * |
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
/* | |
http://graphics.stanford.edu/~seander/bithacks.html | |
*/ | |
int is_power_of_two(unsigned int x) | |
{ | |
return ((x != 0) && !(x & (x - 1))); | |
} | |
int count_bits(unsigned int v) |
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
#!/usr/bin/env python | |
''' wrapping coordinates ''' | |
import os, sys | |
from math import * | |
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
#!/usr/bin/env python | |
''' fit a simple equation ''' | |
import os, sys | |
from math import * | |
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
function random_color(cmin, cmax) | |
{ | |
var x = Math.random() * 6; | |
var i = Math.floor( x ), r = 0, g = 0, b = 0; | |
if ( cmin == undefined || cmin == null ) cmin = 0; | |
if ( cmax == undefined || cmax == null ) cmax = 255; | |
var cvar = cmax - cmin + 1; | |
x -= i; | |
if ( i < 1 ) { // red to yellow |
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 <math.h> | |
__inline double rand01_kiss(void) | |
{ | |
#define znew(z) (z = 36969 * (z & 65535) + (z >> 16)) | |
#define wnew(w) (w = 18000 * (w & 65535) + (w >> 16)) | |
#define MWC(z, w) ((znew(z) << 16) + wnew(w)) |
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
/* Solving the integral equation for the one-component plasma | |
* To compile | |
* gcc ocp.c -lfftw3 -lm | |
* To run the program | |
* ./a.out | |
* To view the output | |
* gnuplot "cr.dat" u 1:2 t "c(r)", "" u 1:3 t "t(r)", "" u 1:($2+$3) t "h(r)" | |
**/ | |
#include <stdio.h> | |
#include <stdlib.h> |
NewerOlder