Skip to content

Instantly share code, notes, and snippets.

View gbishop's full-sized avatar

Gary Bishop gbishop

View GitHub Profile
@gbishop
gbishop / Run.js
Created January 9, 2011 02:20
Komodo Edit macro to Save and Run a Python program, killing the previous instance if necessary
if (komodo.view) { komodo.view.setFocus() };
komodo.doCommand('cmd_save')
ko.run.output.kill(-1);
setTimeout(function(){
ko.run.runEncodedCommand(window, '%(python) -i \"%F\" {\'cwd\': u\'%D\'}');
}, 100);
@gbishop
gbishop / iPadAudio
Created December 21, 2011 20:04
Play sound on the iPad from Javascript using jquery mobile
I keep forgetting how to do this...
To play audio in Safari on the iPad using javascript you have to create the audio node in response to a user event. You have to give the audio node a legal url and call load. Then reuse that same node to play sounds in the future.
In jquery mobile I bound to the 'tap' event on body. If I haven't already created the audio object I create it there. Then I can use it later.
@gbishop
gbishop / remoteCommand.js
Created February 9, 2012 00:31
A web-testing hack to allow me to force refresh in several browsers simultaneously.
$(function(){
/* poll for commands to run. I mostly use it with window.location.reload(true); */
function remoteCommand() {
$.ajax({
url: "/wp-content/themes/thr3/remoteCommand.php",
cache: false,
timeout: 100000,
success: function(data) {
if (data != 'no') {
@gbishop
gbishop / xorg.conf
Created August 26, 2012 21:16
Drive two HD displays in portrait mode using nVida graphics on Ubuntu Precise
# I couldn't get the GUI tools to do the right thing so I edited the generated file by hand.
# the key magic is the Option Rotate right along with the placement
# nvidia-xconfig: X configuration file generated by nvidia-xconfig
# nvidia-xconfig: version 295.40 (buildmeister@swio-display-x86-rhel47-04.nvidia.com) Thu Apr 5 22:33:07 PDT 2012
Section "ServerLayout"
Identifier "Layout0"
Screen 0 "Screen0" 0 0
InputDevice "Keyboard0" "CoreKeyboard"
@gbishop
gbishop / xorg.conf
Created November 16, 2012 00:04
nVidia X11 configuration for dual portrait mode monitors
Section "Monitor"
Identifier "Monitor0"
VendorName "Unknown"
ModelName "SHARP HDMI"
HorizSync 15.0 - 75.0
VertRefresh 23.0 - 76.0
Option "DPMS"
EndSection
Section "Screen"
@gbishop
gbishop / fonts.conf
Created November 21, 2012 14:00
Replace sans-serif and Arial fonts with Ubuntu
<!--?xml version="1.0"?>-->
<!--DOCTYPE fontconfig SYSTEM "fonts.dtd">-->
<!-- ~/.fonts.conf for per-user font configuration -->
<fontconfig>
<alias>
<family>sans-serif</family>
<prefer>
<family>Ubuntu</family>
</prefer>
</alias>
@gbishop
gbishop / comp116.py
Created January 15, 2014 20:40
Simple python module to download iPython Notebooks and supporting files for my students in Comp116
'''Comp116 support module with tools for downloading assignments, lecture notes, and exams'''
import urllib
import os
import os.path as osp
import urlparse
import json
import time
ATTEMPTS = 10
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@gbishop
gbishop / NotebookArgs.ipynb
Created February 5, 2016 18:17
Get sys.argv from the query string. This way I can link notebooks together passing args along.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@gbishop
gbishop / Args.ipynb
Last active July 18, 2022 11:43
Allow arguments to be passed to notebooks via URL or command line.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.