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
| #!/bin/bash | |
| color=31 | |
| for name in "$@"; do | |
| yarn run "$name" | while IFS= read -r line; do | |
| printf "\033[%dm$name:\033[0m %s\n" $color "$line" | |
| done & | |
| (( color++ )) | |
| done | |
| wait |
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 python3 | |
| import csv | |
| import sys | |
| import argparse | |
| parser = argparse.ArgumentParser(description=( | |
| 'Process CSV files in a streaming fashion. By default, assumes there is a' | |
| ' header row and columns are selected by name. If the -i flag is passed,' | |
| ' columns are selected by indices starting from 0 and no header row is' |
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
| /* Compile with: gcc -O3 vtable-vs-switch.c -o vtable-vs-switch */ | |
| /* Execute: time ./vtable-vs-switch switch */ | |
| /* time ./vtable-vs-switch vtable */ | |
| /* Execution time should last less than a minute. */ | |
| #include <stdio.h> | |
| #include <string.h> | |
| #include <stdlib.h> | |
| static FILE *output; |
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
| from random import randint | |
| CHOICES = ['rock', 'paper', 'scissors'] | |
| INITIALS = [c[0] for c in CHOICES] | |
| class Player(object): | |
| def __init__(self, name): | |
| self.name = name | |
| def get_name(self): |
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
| all clean: build build-opt | |
| @$(MAKE) -s -C build $@ | |
| @$(MAKE) -s -C build-opt $@ | |
| build: | |
| mkdir -p $@ ; cd $@ && \ | |
| cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=Yes \ | |
| -DCMAKE_BUILD_TYPE=Debug .. | |
| build-opt: |
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
| import sys | |
| from struct import pack | |
| def usage(): | |
| sys.stderr.write("Usage: %s -w WIDTH -h HEIGHT [-s SIZE]\n" % \ | |
| (sys.argv[0], )) | |
| sys.stderr.write(" -w WIDTH Image width\n") | |
| sys.stderr.write(" -h HEIGHT Image height\n") | |
| sys.stderr.write(" -s SIZE Size of the checkers (default 100)\n") | |
| sys.exit(1) |
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
| #!/bin/bash | |
| # | |
| # Copyright (C) 2013 Ian Liu Rodrigues <[email protected]> | |
| # | |
| # This program is free software: you can redistribute it and/or modify | |
| # it under the terms of the GNU General Public License as published by | |
| # the Free Software Foundation, either version 3 of the License, or | |
| # (at your option) any later version. | |
| # | |
| # This program is distributed in the hope that it will be useful, |
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
| // compile with: gcc atomic-sum.c -lpthread | |
| #define __STDC_FORMAT_MACROS | |
| #include <pthread.h> | |
| #include <stdio.h> | |
| #include <time.h> | |
| #include <unistd.h> | |
| #include <inttypes.h> | |
| uint64_t sum = 0; | |
| static int n_threads = 4; |
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
| X = 8.95 | |
| xx = [1.4, 2.3, 4.0, 5.9, 10.0, 10.1] | |
| n = len(xx) | |
| ff = [x*x for x in xx] | |
| ww = [1.0 for i in range(n)] | |
| for i in range(n): | |
| for j in range(n): | |
| if i != j: |
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
| PROGRAM interpol | |
| Implicit none | |
| double precision :: Y, X = 8.95 | |
| double precision :: s1, s2, p | |
| integer :: n = 6, i, j | |
| double precision,allocatable,dimension(:) :: xx, ff, ww | |
| allocate(xx(n)) | |
| allocate(ff(n)) |