Note: replace {{server}} with your domain or ip
- Login as the ec2-user
ssh -i key.pem ec2-user@{{server}}
- Switch to administrator
sudo -i
| <!doctype html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>App Redirection</title> | |
| </head> | |
| <body> | |
| <!-- | |
| NOTE: This was a great hack in days gone by, but now both Apple and Google have improved their support for custom | |
| protocol handlers. |
| /** | |
| * More info? | |
| * [email protected] | |
| * http://aspyct.org | |
| * | |
| * Hope it helps :) | |
| */ | |
| #include <stdio.h> | |
| #include <stdlib.h> |
| // Inspired by https://github.com/logicalparadox/backbone.iobind/blob/master/lib/sync.js | |
| // Overwrite Backbone.sync method | |
| Backbone.sync = function(method, model, options){ | |
| // create a connection to the server | |
| var ws = new WebSocket('ws://127.0.0.1:1234'); | |
| // send the command in url only if the connection is opened | |
| // command attribute is used in server-side. | |
| ws.onopen = function(){ |
Note: replace {{server}} with your domain or ip
ssh -i key.pem ec2-user@{{server}}
sudo -i
| export default x=>document.createElement('a').href=x |
| # We have a function that loads some resource. It might get called multiple times by our application, for example a web server. | |
| # We use a stored promise to serve as both a cache and a hook for multiple callers to get the same result | |
| # JavaScript version at the bottom | |
| Q = require 'q' | |
| loadPromise = null | |
| doLoad = -> | |
| if not loadPromise | |
| # get a fresh result | |
| loadPromise = Q.delay(1000).then -> Date.now() | |
| # after 1 second clear cache |
| function toHex(s) { | |
| // utf8 to latin1 | |
| var s = unescape(encodeURIComponent(s)) | |
| var h = '' | |
| for (var i = 0; i < s.length; i++) { | |
| h += s.charCodeAt(i).toString(16) | |
| } | |
| return h | |
| } |
| 1. The texture target needs to be GLES20.GL_TEXTURE_EXTERNAL_OES instead of GL_TEXTURE_2D, e.g. in the glBindTexture calls and glTexParameteri calls. | |
| 2. In the fragment shader define a requirement to use the extension: | |
| #extension GL_OES_EGL_image_external : require | |
| 3. For the texture sampler used in the fragment shader, use samplerExternalOES instead of sampler2D. | |
| Everything below here is all in the C code, no more Java. | |
| 4. In the C code, use glEGLImageTargetTexture2DOES(GL_TEXTURE_EXTERNAL_OES, eglImage) to specify where the data is, instead of using glTexImage2D family of functions. |
| //To run Q.js examples: | |
| // 1. Open a new browser tab in Chrome and turn on developer toolbar (or open any http site). | |
| // 2. Copy/Paste this gist in the console and hit enter to run the snippets. | |
| // Based on the inspiration from samples @ https://github.com/kriskowal/q | |
| //////////////////////////////////////////////////////////////////// | |
| //////////////////////////////////////////////////////////////////// |