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: g++ copyfile.cc -o copyfile -lboost_timer -lboost_system -lboost_filesystem -g | |
| // Run: ./copyfile testfile destfile 100 | |
| #include <string> | |
| #include <iostream> | |
| #include <sstream> | |
| #include <cstdio> | |
| #include <cstdlib> | |
| #include <fstream> | |
| #include <sys/sendfile.h> |
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
| Sub Normostrany() | |
| Dim Title As String | |
| Dim CharCount As Long | |
| Dim Message As String | |
| Dim Pages As Double | |
| CharCount = ActiveDocument.BuiltInDocumentProperties("Number of characters (with spaces)") | |
| Pages = CharCount / 1800# | |
| Title = "Počet normostran" |
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 | |
| # pip install runipy | |
| find . -maxdepth 1 -name "*ipynb" -print0 | xargs -0 -n1 runipy |
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 anaconda { | |
| # Added by Anaconda 2.1.0 installer | |
| export PATH="/opt/anaconda/bin:$PATH" | |
| # Fix to use pure anaconda Qt | |
| export QT_PLUGIN_PATH="/opt/anaconda/plugins" | |
| } | |
| function workon { | |
| echo "Initializing anaconda..." |
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
| #!ruby | |
| # Simple script to change all the file names in current directory to small case | |
| require 'fileutils' | |
| Dir.foreach(".") do |fn| | |
| n = fn.downcase | |
| if n != fn | |
| FileUtils.mv(fn, n) | |
| end |
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 as np | |
| def gamma_matrix(rm, tm, dta=1.0, dd=0.05): | |
| '''Compute matrix of gammma indices. | |
| :param rm: reference matrix (relative values assumed) | |
| :param tm: tested matrix (relative values assumed) | |
| :param dta: maximum distance-to-agreement (in voxels) | |
| :param dd: maximum dose difference |
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 | |
| import pydons | |
| import sys | |
| def _wrap_with(code): | |
| def inner(text, bold=True): | |
| c = code | |
| if bold: | |
| c = "1;%s" % c | |
| return "\033[%sm%s\033[m" % (c, text) # '\033[m' |
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 my_loadtxt(fname, columns=-1, delimiter=',', dtype='float32'): | |
| with open(fname) as f: | |
| if columns == -1: | |
| line = f.readline() | |
| columns = np.fromstring(line, sep=delimiter).shape[0] | |
| f.seek(0) | |
| rows = 0 | |
| for line in f: | |
| rows += 1 | |
| f.seek(0) |
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
| add2virtualenv /usr/lib64/python2.7/plat-linux2/ |
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 ask | |
| print "Do you want to continue? (y/N) " | |
| answer = STDIN.gets.strip.downcase | |
| if answer != "y" | |
| return false | |
| end | |
| return true | |
| end | |
| def get_branch |