Saturday, June 29, 2013
Setup Dynamic DNS
Will likely sign-up with http://freedns.afraid.org/signup/.
Configure symhost to scan for wireless networks upon restart
Edit /etc/rc.local and add the following lines:
iwlist wlan0 scan
iwlist wlan0 scan
Friday, June 28, 2013
Using scp
The slow way
# -- Execute on local computer# Copy hello.txt from local computer to remote home directory
$ scp -i skey.pem hello.txt ubuntu@ec2-54-218-73-84.us-west-2.compute.amazonaws.com:~/
# Copy hello.txt from local to remote home directory, renaming it foo.txt
$ scp -i skey.pem hello.txt ubuntu@ec2-54-218-73-84.us-west-2.compute.amazonaws.com:~/foo.txt
# Copying ~/foo.txt from remote to current local directory
$ scp -i skey.pem ubuntu@ec2-54-218-73-84.us-west-2.compute.amazonaws.com:~/foo.txt .
# Copying ~/foo.txt from remote to local directory cc, renaming it a.b
$ scp -i skey.pem ubuntu@ec2-54-218-73-84.us-west-2.compute.amazonaws.com:~/foo.txt cc/a.b
The fast way
First, setup the ~/.ssh/config file.# -- Execute on local computer
# Copy hello.txt from local computer to remote home directory
$ scp hello.txt awshost1:~/
# Copy hello.txt from local to remote home directory, renaming it foo.txt
$ scp hello.txt awshost1:~/foo.txt
Setting up ssh config
Unwieldy SSH Execution
# -- Executed on local machine# Login to AWS as the ubuntu user using your private key pair
$ cd downloads # or wherever your pem file is
$ ssh -i skey.pem ubuntu@ec2-54-218-73-84.us-west-2.compute.amazonaws.com
# Login to AWS as ubuntu using your private key pair and run uptime command
$ ssh -i skey.pem ubuntu@ec2-54-218-73-84.us-west-2.compute.amazonaws.com uptime
Setting up ~/.ssh/config
# -- Execute on local machine$ mkdir -p ~/.ssh
$ cp ~/downloads/skey.pem ~/.ssh/
$ chmod 400 ~/.ssh/skey.pem
$ chmod 700 ~/.ssh
$ nano ~/.ssh/config # edit the file as shown below
$ cat ~/.ssh/config
Host awshost1
HostName ec2-54-218-35-71.us-west-2.compute.amazonaws.com
User ubuntu
IdentityFile "~/.ssh/skey.pem"
Rapid SSH Execution
# -- Execute on local machine# SSH using the ’awshost1’ alias defined in ~/.ssh/config
$ ssh awshost1
# SSH using an alias, run a command, and then exit
$ ssh awshost1 uptime
Install node and npm
# Update list of available packages
$ sudo apt-get update
# Install a special package
$ sudo apt-get install -y python-software-properties python g++ make
# Add a new repository for apt-get to search
$ sudo add-apt-repository ppa:chris-lea/node.js
# Update apt-get’s knowledge of which packages are where
$ sudo apt-get update
# Now install nodejs and npm
$ sudo apt-get install -y nodejs
# Check node and npm are installed
$ npm --version
1.2.32
$ node --version
v0.10.12
Setup git and heroku
# Execute these commands on your EC2 instance.
# Note that -qO- is not -q0-. O is the English letter, 0 is the number zero.
# 1) Install heroku and git
$ sudo apt-get install -y git-core
$ wget -qO- https://toolbelt.heroku.com/install-ubuntu.sh | sh
$ which git
$ which heroku
# 2) Login and set up your SSH keys
$ heroku login
$ ssh-keygen -t rsa
$ heroku keys:add
# 3) Clone a sample repo and push to heroku
$ git clone https://github.com/heroku/node-js-sample.git
$ cd node-js-sample
$ heroku create
$ git push heroku master
# Note that -qO- is not -q0-. O is the English letter, 0 is the number zero.
# 1) Install heroku and git
$ sudo apt-get install -y git-core
$ wget -qO- https://toolbelt.heroku.com/install-ubuntu.sh | sh
$ which git
$ which heroku
# 2) Login and set up your SSH keys
$ heroku login
$ ssh-keygen -t rsa
$ heroku keys:add
# 3) Clone a sample repo and push to heroku
$ git clone https://github.com/heroku/node-js-sample.git
$ cd node-js-sample
$ heroku create
$ git push heroku master
Simple ssh server and client setup on Ubuntu
See: http://www.cyberciti.biz/faq/ubuntu-linux-openssh-server-installation-and-configuration/
SSHD Configuration & Commands
To be frank your server is ready by default. Just test it from your home computer or from same system with the command:
OR
To stop ssh server, enter:
To start sshs server, enter:
To restart ssh server, enter:
SSH Server and Client Installation
Type the following two command to install both ssh client and server:# sudo apt-get install openssh-server openssh-client
SSHD Configuration & Commands
To be frank your server is ready by default. Just test it from your home computer or from same system with the command:
# ssh localhost
OR
# ssh user@your-server-ip-address
To stop ssh server, enter:
# sudo /etc/init.d/ssh stop
To start sshs server, enter:
# sudo /etc/init.d/ssh start
To restart ssh server, enter:
# sudo /etc/init.d/ssh restart
How do I use ssh client?
Assuming that your server hostname is userver.mydomain.com and username is vivek, you need to type the following command:# ssh vivek@userver.mydomain.com
Thursday, June 27, 2013
DJTube Design Concepts
Design Concepts
- A series of images for animation
- Animation playback speed
- Synchronizing two audio loop - master loop determines loop of slave loop video and audio
- graphics interaction - to determine if mouse hits a record
Implementation Techniques
- Where to get images -- Internet Archive, access to huge array of copyright free video
- Search for VJ Loops
- Split video into individual frames using ImageSaver
- .png files are transparent
- current frame selects the frame
player2.speed(player2.getLengthMs()/
player1.getLengthMs());
Using speedAdjust variable to change speed of audio and video:
player1.speed(speedAdjust);
player2.speed(player2.getLengthMs()/
player1.getLengthMs()*speedAdjust);
currentFrame = currentFrame + 1 * speedAdjust
// mouse interaction changes speedAdjust
Audio Concepts
Audio Concepts
Sample Rate - precision in time, horizontalBit Depth - precision in amplitude, vertical dimension
player.speed(1) // 1: normal speed, 2: double the speed
speed = map(mouseX, 0, width, 0, 2)
Audio Control
- speed
- stop/start
if (buttonOn) { fill(255,0,0) }
if (!buttonOn) { fill(,255,0) }
Image commands and concepts
Image commands
Pimage img = loadImage("file.png")
image(img, pos-x, pos-y, size-x, size-y)imageMode(CORNER);
// CORNER -- Top left of image at pos-x, pos-y
// CENTER -- Center of image at pos-x, pos-y
Layout Concepts
- margin
- layout in columns or rows
image(img, width/2, margin)
posX = width/2 - margin - img.width/2; posY = height/2 + margin + img.height/2;
image(img, posX, posY)
Animation Concepts
- pausing -- use a boolean flag "playing"
playing = !playing; // toggles playing state
Program Template
// DeclarationsPimage [] images;
int currentPosition = 0;
// void setup()
images = loadImages("Animation_data/movie", ".jpg", 134);
size(images[0].width, images[0].height);
// void draw()
image(images[currentPosition], 0, 0); // draw the current image
currentPosition += 1; // move to the next image
if(currentPosition >= images.length)
currentPosition = 0; // when you get to the end, loop
Design of Sonic Painter
A few key design points that make Sonic Painter great:
Between you and SP
Between objects in SP themselves
Color Design elements:
- The key to making it look nice is about having really, really good sound and image integration, so that people really feel that it's interactive.
- And, also mapping information from one domain to another.
- What makes a really visual app is really, really good brushes
- Just because you've got only one input, doesn't mean you should only have those one inputs.
- You can use symmetry to create order out of something that doesn't look that ordered. The more layers of symmetry you add, the more people find it attractive
- Draw shapes on the screen
- They slowly rub each other out
- There are different brushes
- As you make a gesture to draw a shape, it plays back and manipulates a sound.
Between you and SP
Between objects in SP themselves
Color Design elements:
- mouse x-position => color red
- mouse y-position => color blue
- distance from some point e.g. center => green
- speed => alpha, lineWidth
- size of circle changes with speed
- brush that generates more than one output
- Symmetry - eight orders of symmetry!
- contrasting sounds: ambient vs bells
- balance the sound volume player.volume(0.25)
- sound speed
- sound filter ... ambient sound "brighter" or "darker"
- mapping mouse position to color red
- constraining variables e.g. lineWidth, constrain()
Where to get audio files?
1. Get them from freesound.org
2. Create them yourself using audacity
2. Create them yourself using audacity
Enable Developer Mode on Android
On Android 2.2.1, go to
Settings > Applications > Development > USB debugging (Enabled)
Settings > Applications > Development > USB debugging (Enabled)
Monday, June 24, 2013
Machine Learning Books
Machine Learning for Hackers
Machine Learning in Action
Programming Collective Intelligence
Machine Learning in Action
Programming Collective Intelligence
A decision tree to choose a Machine Learning algorithm
Awesome course on Machine Learning
The Coursera course on Machine Learning by Andrew Ng is just awesome!
Subscribe to:
Posts (Atom)