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
def find_flips(mesh, start_el_nr=None, flip_flags=None, remaining_els=None, thresh=1e-5): | |
if start_el_nr is None: | |
start_el_nr = 0 | |
if flip_flags is None: | |
flip_flags = np.zeros(len(mesh), dtype=np.bool) | |
if remaining_els is None: | |
remaining_els = set(xrange(len(mesh))) | |
remaining_els.remove(start_el_nr) |
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
\nonstopmode | |
\usepackage[letterpaper, margin=1in]{geometry} | |
\usepackage[utf8]{inputenc} | |
\usepackage{xcolor} | |
\usepackage{url} | |
\usepackage{hyperref} | |
\usepackage{keystroke} | |
\usepackage{tikz} | |
\usepackage{ifthen} |
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 | |
from json import load, dump | |
import sys | |
if len(sys.argv) != 3: | |
print("usage: %s INFILE OUTFILE", file=sys.stderr) | |
with open(sys.argv[1], "rt") as inf: |
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
def fake_newton(f): | |
print f(17) | |
def main(): | |
target_value = 18 | |
def f(x): | |
return x - target_value | |
fake_newton(f) |
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 numpy | |
import pycuda.autoinit | |
import pycuda.driver as drv | |
from pycuda.compiler import SourceModule | |
from pycuda.gpuarray import to_gpu | |
mod = SourceModule(""" | |
typedef struct _pair | |
{ |
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/zsh | |
setopt -o EXTENDED_GLOB | |
cp -R /usr/share/texlive/texmf-dist/tex/latex/tcolorbox . | |
tar cvfz loopy-submission.tar.gz --transform='s,.*/,,' \ | |
loopy.{tex,bib} out/loopy.bbl media/*.pdf *.cls \ | |
tcolorbox/* | |
rm -Rf tcolorbox |
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 <cuda.h> | |
#include <stdio.h> | |
#include <stdexcept> | |
#include <iostream> | |
#define CUDAPP_CALL_GUARDED(NAME, ARGLIST) \ | |
{ \ | |
CUresult cu_status_code; \ | |
cu_status_code = NAME ARGLIST; \ | |
if (cu_status_code != CUDA_SUCCESS) \ |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
def map_comparison(self, expr, *args, **kwargs): | |
return type(expr)( | |
self.rec(expr.left, *args, **kwargs), | |
expr.operator, | |
self.rec(expr.right, *args, **kwargs)) | |
def map_logical_not(self, expr, *args, **kwargs): | |
return type(expr)( | |
self.rec(expr.child, *args, **kwargs)) |
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 | |
if [[ -z "$TMUX" ]]; then | |
echo "This wants to be run inside of tmux" | |
exit 1 | |
fi | |
tmux set-option set-remain-on-exit on | |
for machine in porter stout quail pheas; do | |
tmux neww -n $machine ssh -t root@$machine "$@" |