Skip to content

Instantly share code, notes, and snippets.

View petebachant's full-sized avatar
💭
Building stuff

Pete Bachant petebachant

💭
Building stuff
View GitHub Profile
@petebachant
petebachant / atom
Created July 29, 2017 10:59
Custom script to call the Windows Atom executable from WSSL
import subprocess
import os
import sys
try:
args = sys.argv[1:]
except IndexError:
args = []
atom_exe = "cmd.exe /mnt/c/Users/peteb/AppData/Local/atom/bin/atom.cmd"
@petebachant
petebachant / openfoam-activate.sh
Last active May 28, 2016 13:39
Function in my bashrc for activating OpenFOAM envs
function openfoam() {
OF_VERSION=$1
# echo "Activating OpenFOAM-$OF_VERSION environment"
source /home/pete/OpenFOAM/OpenFOAM-$OF_VERSION/etc/bashrc
if [[ "$OF_VERSION" == "2"* ]]
then
export ParaView_DIR=/home/pete/OpenFOAM/ThirdParty-$OF_VERSION/platforms/linux64Gcc/ParaView-4.1.0
@petebachant
petebachant / dev.sh
Created February 10, 2016 13:22
Starting my typical Python development environment on Windows using Git Bash.
function auth() {
eval `ssh-agent` > /dev/null
ssh-add
}
# Call this function from Git Bash after entering the project dir
function dev() {
atom .
explorer .
jupyter qtconsole --no-confirm-exit &
@petebachant
petebachant / swak4Foam-OpenFOAM-dev-errors.log
Created February 8, 2016 04:09
Errors compiling swak4Foam with OpenFOAM-dev
Previously compiled for OpenFOAM dev
/home/pete/OpenFOAM/pete-dev/swak4foam-dev/privateRequirements/bin existing. Prepending to PATH-variable (private version of Bison)
No file 'swakConfiguration'. Python etc won't work. See README for details
Try 'ln -s swakConfiguration.automatic swakConfiguration' for automatic configuration. BEWARE: this does not work on some systems
Checking swak4Foam-version and generating file
Swak version is 0.4.0
Bison is version 2.7.12-4996
Flex is version 2.5.35 (Minor version: 35)
@petebachant
petebachant / update-openfoam-version.sh
Created November 29, 2015 21:25
Converting all OpenFOAM header versions
OLD_VERSION="2.4.x"
NEW_VERSION="3.0.x"
find . -type f -exec sed -i 's/$OLD_VERSION/$NEW_VERSION/g' {} +
@petebachant
petebachant / license.md
Created October 18, 2015 03:36
Typical license for a research item repository--MIT for code, CC-BY for everything else.
@petebachant
petebachant / update-atom.sh
Last active March 28, 2016 01:58
A script to automatically install the latest Atom editor on Linux via deb package.
#!/usr/bin/env bash
# From http://askubuntu.com/questions/589469/how-to-automatically-update-atom-editor
wget https://github.com/atom/atom/releases/latest -O ~/Downloads/latest
wget $(awk -F '[<>]' '/href=".*atom-amd64.deb/ {match($0,"href=\"(.*.deb)\"",a); print "https://github.com/" a[1]} ' ~/Downloads/latest) -O ~/Downloads/atom-amd64.deb
sudo dpkg -i ~/Downloads/atom-amd64.deb
@petebachant
petebachant / toggle.py
Last active August 29, 2015 14:09
Toggle a BeagleBone digital output.
#!/usr/bin/env python
from Adafruit_BBIO import GPIO
pin = "P8_13"
exit = False
state = 1
GPIO.setup(pin, GPIO.OUT)
@petebachant
petebachant / OpenFOAM_Forces.py
Last active April 15, 2024 17:05
Extracting forces and moments from OpenFOAM postProcessing
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 8 09:22:09 2013
@author: pete
"""
import matplotlib.pyplot as plt
import re