I wrote a simple app to triangulate Strongholds in Minecraft. Instead of wasting a bunch of Eyes of Ender trying to get to a Stronghold, you can just do a couple of throws and get a good estimate of its position.
I wrote a set of Python bindings for the Ngspice simulation engine. It’s meant to add the clarity and power of Python to electronics simulations. For instance, you can simulate a circuit while varying different parameters and produce highly customized plots of your results, while minimizing your exposure to SPICE syntax.
More details on the project page.
I made templates you can print out to build the Wigner-Seitz cells for hexagonal, body-centered cubic and face-centered cubic crystals. Check out the ideal result:
And the actual result:
You can print these out to build your own:
I used blender to model the cells in 3D and UV-unwrapped them into svg files. These I edited with inkscape to add the edge tabs.
I had some trouble deploying a Flask app with Apache2, so here’s a minimum working configuration.
Virtual environment setup
virtualenv appname cd appname source bin/activate pip install flask mkdir -p src/appname www echo "site.addsitedir(os.path.join(base, 'src'))" >> bin/activate_this.py echo "from .appname import *" > src/appname/__init__.py cat > src/appname/appname.wsgi <<EOF activate_this = '/path/to/virtualenv/bin/activate_this.py' execfile(activate_this, dict(__file__=activate_this)) from appname import app as application EOF cat > src/appname/appname.py <<EOF from flask import Flask app = Flask(__name__) @app.route('/') def index(): return "Success?" if __name__ == '__main__': app.run() EOF
Virtual host configuration
<VirtualHost *:80> ServerName host.name ServerAlias www.host.name DocumentRoot /path/to/virtualenv/www <Directory /path/to/virtualenv/www> Order allow,deny Allow from all </Directory> WSGIScriptAlias /connote /path/to/virtualenv/src/connote/connote.wsgi WSGIDaemonProcess host.name processes=2 threads=15 WSGIProcessGroup host.name <Directory /path/to/virtualenv/src/connote> Order allow,deny Allow from all </Directory> ErrorLog /path/to/virtualenv/var/error.log LogLevel debug </VirtualHost>
I’ve been playing around with Monte Carlo simulations of the Ising model. The idea is that you have a grid of dipoles (think bar magnets) which interact with their neighbours. They can point up or down, and they feel a force from their neighbours which tends to make them parallel. However, there’s also random thermal motion which flips them randomly.
Depending on the ratio of interaction energy to thermal energy, different behaviors emerge from the lattice. The most interesting one is that below the critical temperature, the lattice spontaneously magnetizes, meaning there’s an imbalance between up and down. This models what happens in ferromagnets, which can retain magnetization if they are below the Curie temperature.
I’ve settled on this workflow for writing lab reports in a group:
- We share a folder with Dropbox that holds the measurements and report files (graphs, latex source files).
- To prevent collisions we use separate .tex files for different sections, and split the sections between group members.
- To make sure the output is consistent, only one person compiles the PDF. Inspired by this blog post I wrote a short script to build the PDF whenever a file changes:
#!/bin/bash while true do echo Compiling pdflatex -interaction nonstopmode -file-line-error informe.tex &>salida.log inotifywait -e modify -r . done
Previously I’d tried running
in a loop (it only compiles if one of the input files changed). However, this script automatically checks all files for changes, without having to add them to a Makefile.