clear && find . -name “*.tex” -exec grep -Hn <search string> {} \;
Author Archive
Python script to extract citation keys from latex files
By thomas in latex, python”’ Created on May 10, 2014 @author: thomas ”’ import fnmatch import os”’ Created on May 10, 2014 @author: thomas ”’ import fnmatch import os import re if __name__ == ‘__main__’: directory = ‘/home/thomas/Ph.D/Projekter/057 2014-03-10 Database paper/latex-version/databasepaper’ matches = [] for root, dirnames, filenames in os.walk(directory): for filename in fnmatch.filter(filenames, ‘*.tex’): matches.append(os.path.join(root, filename)) print(matches) pattern= […]
finding text in files using find in linux
By thomas in linux, ubuntuBased on this stack-overflow response: http://stackoverflow.com/questions/16956810/finding-all-files-containing-a-text-string-in-linux one way of searching for files containing a certain text patterns is: grep -rnw ‘directory’ -e “pattern” if you want to search relative to your current position replace “directory” with a . so: grep -rnw . -e “pattern”
Tags: find
Matlab: calling a function handle with parameters from a cell array
By thomas in matlabHaving a function handle sometimes means that you want to be flexible regarding the number of input arguments. having a function handle fhandle=@plot means that you can call fhandle() but is you want to pass a variable number of arguments to fhandle that resides in a cell array, cparameters, containing e.g.: cparameters={[1:10],’resize’,’no’} you can do: […]
Tags: cellarray, function handle, matlab, varargin
Python search path
By thomas in pythonIt seems like that the search path that python searches for modules can be retrieved from sys.path
Tags: python, search path
installation of pygame for python3
By thomas in pythonThe installation process that worked consisted of the following steps: #install dependencies sudo apt-get install mercurial python3-dev python3-numpy ffmpeg \ libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev libsmpeg-dev \ libsdl1.2-dev libportmidi-dev libswscale-dev libavformat-dev libavcodec-dev Download the latest pygame from repository: https://bitbucket.org/pygame/pygame/wiki/VersionControl run: python3 config.py run: 2to3 setup.py -w run: python3 setup.py build run: sudo checkinstall python3 setup.py install
Tags: 2ti3, checkinstall, pygame, python3
points on a sphere
By thomas in geometrynice link with formulas for relating points on a sphere to 3D points: https://www.opengl.org/discussion_boards/showthread.php/159883-converting-a-3D-vector-into-three-euler-angles
Tags: parametrisation, sphere
plot functions in mathematica
By thomas in Mathematica, Uncategorizedcontour plots can be used in mathematica to plot equations such as ellipsoids like: 1/10^2*x^2 + 1/6^2*y^2 + 1/15^2*z^2 == 1 a command like: ContourPlot3D[ 1/10^2*x^2 + 1/6^2*y^2 + 1/15^2*z^2 == 1, {x, -11, 11}, {y, -7, 7}, {z, -16, 16}] creates the ellipsoid
push all submodules in a git repo
By thomas in GITIf you have a git repository that consist of several submodules you can push all submodules by doing the following: place yourself in the main git repo. write: git submodule foreach git push To make sure that you get through all the submodules even if errors occurs do: git submodule foreach “git push || true”
Tags: foreach, git, submodules