Portions taken from http://www.cs.utexas.edu/~mitra/csSpring2011/cs327/cx_mac.html (in case that link ever dies.)
Assume you've got homebrew installed.
Download the following files from Oracle
| import canvas | |
| canvas.set_size(512, 512) | |
| from_point = (10, 10) | |
| cp1 = (40, 200) #control point 1 | |
| cp2 = (350, 50) #control point 2 | |
| to_point = (300, 300) | |
| # Draw the actual curve: |
| # This is a really old post, in the comments (and stackoverflow too) you'll find better solutions. | |
| def find(key, dictionary): | |
| for k, v in dictionary.iteritems(): | |
| if k == key: | |
| yield v | |
| elif isinstance(v, dict): | |
| for result in find(key, v): | |
| yield result | |
| elif isinstance(v, list): |
| { | |
| "//field": "These 'double quote' 'double quote' are used as comments, because JSON doesnt' allow comment", | |
| "field": {}, | |
| "#another-field": "Another comment", | |
| "another-field": {}, | |
| "/*stuff": "Be careful to use them when you have full control of the content :)", | |
| "stuff": [], | |
| "bla": "bla" | |
| } |
| #!/bin/bash | |
| function setjdk { | |
| local ver=${1?Usage: setjdk <version>} | |
| export JAVA_HOME=$(/usr/libexec/java_home -v $ver) | |
| PATH=$(echo $PATH | tr ':' '\n' | grep -v Java | tr '\n' ':') | |
| export PATH=$JAVA_HOME/bin:$PATH | |
| java -version |
| ''' | |
| Pythonista Find and Replace | |
| =========================== | |
| Notices | |
| ------- | |
| Copyright 2013 Harry Jubb. | |
| This program is free software: you can redistribute it and/or modify |
| # | |
| # Hydrogen is a lightweight GUI framework for Pythonista | |
| # | |
| # Hydrogen - https://gist.github.com/BashedCrab/5924965 | |
| # | |
| # HydrogenLayouts - https://gist.github.com/BashedCrab/6103019 | |
| # | |
| # HydrogenDemo - https://gist.github.com/BashedCrab/5953776 | |
| # |
Portions taken from http://www.cs.utexas.edu/~mitra/csSpring2011/cs327/cx_mac.html (in case that link ever dies.)
Assume you've got homebrew installed.
Download the following files from Oracle
| # Update: This looks like a far better solution... | |
| # `console.set_idle_timer_disabled(flag)` | |
| # Disable or enable the idle timer (which puts the device to sleep after a certain period of inactivity). | |
| # noDoze.py -- keep relaunching yourself to prevent | |
| # your iOS device from falling asleep. | |
| import notification, time, urllib | |
| def argsString(argv): |
| # sounder.py | |
| # play each of the .caf sounds inside the Pythonista.app | |
| import os, os.path, scene, sound | |
| framesPerSound = 60 | |
| pythonistaDir = os.path.expanduser('~/Pythonista.app') | |
| #print(os.listdir(pythonistaDir)) | |
| soundFileExtention = '.caf' | |
| wallpaperAppIcon = ('/AppIcon76x76@2x~ipad.png', '/AppIcon60x60@2x.png') |
| (function () { | |
| this.uniqid = function (pr, en) { | |
| var pr = pr || '', en = en || false, result; | |
| this.seed = function (s, w) { | |
| s = parseInt(s, 10).toString(16); | |
| return w < s.length ? s.slice(s.length - w) : (w > s.length) ? new Array(1 + (w - s.length)).join('0') + s : s; | |
| }; | |
| result = pr + this.seed(parseInt(new Date().getTime() / 1000, 10), 8) + this.seed(Math.floor(Math.random() * 0x75bcd15) + 1, 5); |