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
import numpy as np | |
import matplotlib.pylab as plt | |
import torch | |
from torch import nn | |
from sklearn.metrics.pairwise import euclidean_distances | |
from som_measures import topographic_error, quantization_error |
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
import numpy as np | |
import matplotlib.pylab as plt | |
def f(x): | |
return 50 - x**2 | |
if __name__ == '__main__': | |
np.random.seed(12345) |
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> | |
#define GENERIC_MAX( type ) \ | |
type type##_MAX(type a, type b) \ | |
{ \ | |
return (a > b) ? a : 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
#include <stdio.h> | |
#include <stdlib.h> | |
#define PATH_MAX 3000 | |
/* Compile with -D_BSD_SOURCE */ | |
/* sym2actual converts a path to an absolute one | |
* | |
* Args: | |
* symlinkpath (pointer to char): The input path string | |
* |
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> | |
void print_buffer(void *, int); | |
void catbin(char *); | |
int main(int argc, char **argv) { | |
if (argc == 2){ viewbin(argv[1]); } | |
else{ | |
printf("Please type the name of the binary input file!\n"); | |
printf("Example: viewbin foo.dat \n"); |
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> */ | |
static inline void fclosep(FILE **fp) { if (*fp) fclose(*fp); *fp=NULL; } | |
#define _cleanup_fclose_ __attribute__((cleanup(fclosep))) | |
void example_usage(void) | |
{ | |
_cleanup_fclose_ FILE *logfile = fopen("logfile.txt", "w+"); | |
fputs("hello logfile!", logfile); |
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> | |
typedef struct TClosure { | |
int (*code)(struct TClosure *env, int); | |
int state; | |
} Closure; | |
int call(Closure *c, int x) { | |
return c->code(c, x); |
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
#!/usr/bin/bash | |
tail -n+3 "$0" | gcc -xc - && ./a.out ; exit | |
#include <stdio.h> | |
int main() | |
{ | |
printf("C is a scripting language!\n"); | |
} |
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 <time.h> | |
#define SIZE 1000000 | |
typedef struct { | |
float *x; | |
} test_s; |
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
#!/usr/bin/python | |
# A minimal script that counts the number of words in a LaTeX file. | |
# Example of use: | |
# localhost@name$ wclatex filename | |
import re | |
import sys | |
def word_counter(filename): |
NewerOlder