Skip to content

Instantly share code, notes, and snippets.

View anderspitman's full-sized avatar

Anders Pitman anderspitman

View GitHub Profile
@anderspitman
anderspitman / Makefile
Last active November 9, 2021 18:47 — forked from toolmantim/Makefile
# A simple Makefile alternative to using Grunt for your static asset compilation
#
## Usage
#
# $ npm install
#
# And then you can run various commands:
#
# $ make # compile files that need compiling
# $ make clean all # remove target files and recompile from scratch
#include <time.h>
#include <stdio.h>
int main(int argc, char **argv) {
clock_t start = clock(), diff;
for (int i=100000000; i>0; i--) {
}
diff = clock() - start;
#include <time.h>
double getCPUTimeSeconds() {
clock_t time = clock();
return (double)time / CLOCKS_PER_SEC;
}
double getWallTimeSeconds() {
struct timespec time;
clock_gettime(CLOCK_MONOTONIC, &time);
team_stats stats;
sscanf((char *)line.c_str(),
"%[^\t]%d%f%d%d%f%f%f%d%d%d%d%d%d%d%d%s%d%d%d",
stats.team_name,
&stats.games,
&stats.pts_per_game,
&stats.total_points,
&stats.scrimmage_plays,
&stats.yds_per_game,
7
13
47
allocate CHAR s1 200 "fail"
allocate CHAR s1 20 " a"
allocate CHAR s2 4 "b "
allocate CHAR s3 5 " c "
allocate CHAR s4 8 " d d "
allocate CHAR s5 4 ""
allocate CHAR s6 16 " "
[0] Running command: allocate CHAR s1 500 "fail"
Error: insufficient memory to allocate variable
[1] Running command: map
MEMORY MAP:
| 0 1 2 3 | 4 5 6 7 | 8 9 A B | C D E F |
----------------------------------------------------------------
0x0000 | _ _ _ _ | _ _ _ _ | _ _ _ _ | _ _ _ _ |
0x0010 | _ _ _ _ | _ _ _ _ | _ _ _ _ | _ _ _ _ |
[0] Running command: allocate CHAR s1 500 "fail"
Error: insufficient memory to allocate variable
[1] Running command: map
MEMORY MAP:
| 0 1 2 3 | 4 5 6 7 | 8 9 A B | C D E F |
----------------------------------------------------------------
0x0000 | _ _ _ _ | _ _ _ _ | _ _ _ _ | _ _ _ _ |
0x0010 | _ _ _ _ | _ _ _ _ | _ _ _ _ | _ _ _ _ |
import sys
if __name__ == '__main__':
filename = sys.argv[1]
print(filename)
with open(filename, 'r') as f:
count = 0
prev = 0
Printing data for range: 1992-1992
Nodes: 97444
Edges: 2096
Average degree: 0.0215098
Degree Distribution:
0 95701
1 1473
2 216
Printing data for range: 1963-1963
Nodes: 45679
Edges: 0
Average degree: 0
Degree Distribution:
0 45679