This file contains 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
Redirecting embedded Python’s I/O | |
Posted on 2012-4-13 by mvasilkov | |
When using Python for application scripting, more often than not you want to redirect interpreter’s input/output to the embedding program. This is how it’s done with the Python/C API: | |
PyObject *sys = PyImport_ImportModule("sys"); | |
PyObject *out = PyFile_FromString("python_out", "w+"); | |
PyObject_SetAttrString(sys, "stdout", out); | |
Pretty intuitive, right? Now embedded Python’s stdout points to the newly created file, python_out. Working with the script’s output from C is also trivial: |
This file contains 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 | |
#-- Script to automate https://help.github.com/articles/why-is-git-always-asking-for-my-password | |
REPO_URL=`git remote -v | grep -m1 '^origin' | sed -Ene's#.*(https://[^[:space:]]*).*#\1#p'` | |
if [ -z "$REPO_URL" ]; then | |
echo "-- ERROR: Could not identify Repo url." | |
echo " It is possible this repo is already using SSH instead of HTTPS." | |
exit | |
fi |
This file contains 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 ScriptMarkers() { | |
// Variables: these must be filled out so the session knows your controller layout | |
this.deviceDescription = "Script Markers"; // device name | |
this.needsMidiChannel = false; // send midi controller to daw | |
this.needsMidiBackChannel = false; // send midi daw to controller | |
this.needsOSCSocket = false; // communicate via osc | |
this.numberOfFaderChannels = 0; // number physical faders | |
this.numCharactersForTrackNames = 0; // characters of channel text | |
this.numCharactersForAuxLabels = 0; // characters of aux text |
This file contains 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
Alright , the following podcast will not be possible without my amazing executive producers , Jonathan Kaplan , Russ Matkin , Ben Sherman , Ian A . Chapman , Barry A . Spath , Lori Elsroth , Michael Elsroth , J .C . Dingus , and America's favorite public defender , David Donnelly . Thank you guys so much for making this podcast possible . Enjoy it . Hey , I'm Matt , and this is a very special , "Abracababble." Alright , so normally this is a private podcast , a member's only podcast , but this podcast needs to go out to the masses , right? This is a very shareable piece of information . I have two very special guests with me today . I have a embattled magician , Garrett Thomas . Liar . And I have the judge of Foulas back on for the second time , Mike Close . Here come the judge . Here come the judge . Nice to be here , Matt . Thanks for having me . No problem . No problem . I'm glad to talk about this , and we're going to have some fun . So good to see you again . So no , it's good to see you , Garrett . And |