— count words in html file with python

#!/usr/bin/python

import nltk
import string
from urllib import urlopen
from itertools import imap

url = "http://google.com"
html = urlopen(url).read()
text = nltk.clean_html(html)
text_noPunc = text.translate(string.maketrans("",""), string.punctuation)
words = text_noPunc.split()
max_word_len = max(imap(len, words))
vocabulary = nltk.probability.FreqDist(words)

for word in vocabulary:
    print word,
    print ' ' * (max_word_len + 5 - word.__len__()),
    print str(vocabulary[word])

Using NTLK.

Gist on Github.

— face replace

By Gabriel Dunne and Toby Shachman.

Created and shown over 36 hours during ArtHackDay "Lethal Software" at GAFFTA, December 15, 2012.

Physical installation built with a pre-existing art frame prototype. Viewers experience the work as a large portrait mirror, and they see a face superimposed onto their own in real time. Viewers can take a snapshot of their own face which immediately becomes superimposed onto their own. As people view the mirror, subsequent people have their faces replaced by the previous viewers faces.

A physical knob enables viewers to explore faces people have saved.

Sourcecode on github: https://github.com/quilime/face-replace

Built with OpenFrameworks and ofxFaceTracker and based on examples in FaceSubstitution.

— modulations 2012

Live visuals. Music Performer: Chris Carlson @ CCRMA Modulations 2012

this visual set was based on live-coding experiments with non-periodic tiling patterns. I'm still fascinated with the forms. Towards the end of the night I started using color.

visual software created with: audio-shadertoy

for this setup, the live audio was analyzed by ChucK through the built-in mic on my macbook air. the ChucK script routes osc to Node, and the client receives via web sockets.

because osx-style full-screen multi-monitor support is completely broken in OSX Lion, we couldn't use chrome. so we stripped out all the chrome-only webaudioapi stuff, and replaced it with an osc receiver. This allowed us to analyze the audio with an external interface and use any browser that supports webgl canvas, and does multi-monitory fullscreen correctly on osx. we ended up using firefox.

live-audio branch with float-sliders ui [warning:totally hacky] : http://github.com/quilime/audio-shadertoy/tree/live-audio-ff-datgui

— studio pano

studio panorama taken by Ryan Alexander
flickr

— temple

— DualBoot Archlinux/Windows7 Installation

Documentation of the process of installing archlinux and Windows 7 in a dual-boot configuration.

System Specs

  • AMD X2 dual-core processor, running at 2.8 ghz, circa 2002
  • ASUS ATX motherboard
  • 2 gigs of ram
  • 100gb drive
  • nvidia gtx 550 ti graphics card
  • linksys wmp54g wireless pci network card
  • 550w power supply

Installing Windows

Windows was installed from a USB stick using Microsoft's Windows 7 USB/DVD tool. It's required to create this key from a Windows 7 system. Boot with the USB drive, then install Windows on the drive in a single partition. Windows also creates a System Reserved partition for itself. Once installed, via Start Menu > Administrative Tools > Computer Management > Disk Manamagent, select 'Shrink Partition' on the main Windows parition to create another partition for Arch. The default value for the shrink is 50%, so for my setup the value for the new disk size was ~50GB, which was ideal.

Note about this install. I have an old Linksys (Cysco) WMP54G Wireless PCI Card. Drivers from Linksys/Cysco's website didn't work, but following this blog post, the generic RALink drivers worked great.


more →

— print formatted JSON, XML from osx command line

Working with various interfaces that output json or xml results in lots of situations where you have a single-line, unformatted output. Here's a quick way to format json, xml from the CLI.

via the command line:

format json

cat unformatted.json | python -m json.tool

format json from clipboard

pbpaste | python -m json.tool

format xml from clipboard

pbpaste | xmllint --format -
xmllint is part of libxml2 and installed by default on OSX. Be aware that xmllint cleans up XML as well as formatting it, ocassionally modifying the output.

for all above examples, you can pipe back to the clipboard with | pbcopy at the end of the command, or output to a file with > output.json or > output.xml.

— command line audio on OSX

Since there is no equivilent to /dev/dsp or /dev/audio on OSX, you need to install an alternative like sox.

Install sox by either downloading the OSX binary from http://sox.sourceforge.net/ or install homebrew, and then install sox with brew install sox

Examples

cat audio from /dev/urandom/ :

cat /dev/urandom | sox -traw -r44100 -b16 -u - -tcoreaudio

audio from an executable

cat > test.c
main(t) {
  for( t = 0;;t++)
    putchar( t * ((( t >> 12 ) | (t >> 8)) & (63& (t >> 4 ))));
}
[ctrl-c]
gcc test.c -o test
./test | sox -traw -r8000 -b8 -u - -tcoreaudio

references


— sun

— Water Is Life

near Quotar Minar in Dadabari.

— beg

— dushera

— alphabet

consanants


more →

— islands

Imagine that every man's mind is an island, surrounded by ocean. Each seems isolated, yet in reality all are linked by the bedrock from which they spring. If the ocean were to vanish, that would be the end of the islands. They would all be part of one continent, but their individuality would be gone.

—"The Inspector" Overlord. Childhoods End, Arthur C. Clark. p.176

— childhoods end

The case of India is particularly instructive. The main difference between us and the British in India was that they had no real motives for going there—no conscious objectives, that is, except such trivial and temporary ones as trade or hostility to other European powers. They found themselves possessors of an empire before they knew what to do with it, and were never really happy until they had got rid of it again.

—"The Inspector" Overlord. Childhoods End, Arthur C. Clark. p.161

— dreams

My dreams have been incredibly vivid. probably due to the heat. sleeping at odd hours. been working in the studio most of the day at Vishal's house, so I haven't been going out as much as I would like. Very hot outside.

— sri

— habitat

— arrival

                                 Bkng                          Meals/ Seat/
Day Date       Flight     Status Class       City        Time  Other  Cabin
--- ----- --------------- ------ ----- ---------------- ------ ------ -------
Thu 22SEP KLM ROYAL         OK     T   LV SAN FRANCISCO 200P     M     **
          DUTCH AIRLINES 606           AR AMSTERDAM     915A#         

Fri 23SEP KLM ROYAL         OK     T   LV AMSTERDAM     1120A    M     **
          DUTCH AIRLINES 871           AR DELHI         1050P         

— command history

history | awk {'print $2'} | sort | uniq -c | sort -k1 -rn | head

example

// brand new netbook
  24 ls
  14 cd
  12 defaults
   9 unzip
   8 ssh
   5 mv
   3 mkdir
   3 chmod
   3 cat
   2 unrar
// quilime.com
 173 git
 140 ls
  84 cd
  18 emacs
  15 cat
  13 mv
  12 rm
   5 ln
   4 mkdir
   4 ./scripts/content

— Terminal Emulator on Windows via Cygwin

How to install cygwin on windows:

  1. Install Cygwin from setup.exe

  2. Install the following packages:

    • xorg-server (required, the Cygwin X Server)
    • xinit (required, scripts for starting the X server: xinit, startx, startwin (and a shortcut on the Start Menu to run it), startxdmcp.bat )
    • xorg-docs (optional, man pages)
    • X-start-menu-icons (optional, adds shortcuts to X Clients and Server to the Start menu)
    • mintty (windows-feel terminal)
  3. Optional Packages

    • openssh
    • git, svn
    • wget, curl
    • rsync
    • vim, emacs
    • any additional fonts



more →

— create bootable iso from unix/osx terminal

  1. diskutil list
    Determines the device node assigned to your flash media (e.g. /dev/disk2)

  2. diskutil unmountDisk /dev/disk#
    Replace # with the disk number from the last command; in the previous example, # is 2)

  3. sudo dd if=/path/to/example.iso of=/dev/diskN bs=1m
    Replace /path/to/example.iso with the path to the iso; for example: ./windows7.iso. After typing in your sudo password, the process will start invisibly.

  4. diskutil eject /dev/disk#
    Remove your flash media device when the command completes. Done!

Referenced from BurningIsoHowto

Bonus tip! You want to see how far the dd copy is coming along? Run in another terminal instance:
$ sudo killall -INFO dd
The process info will display in the original terminal.

— filebrowser

File Browser PHP script on GitHub.

demo: media.quilime.com

— show hidden files (OSX Finder)

via Terminal

show hidden files:

defaults write com.apple.finder AppleShowAllFiles TRUE
killall Finder

hide hidden files:

defaults write com.apple.finder AppleShowAllFiles FALSE
killall Finder

— Live Visuals

Sepalcure, Shigeto, Simple & Santa, GAFFTA, San Francisco
April 29 2011

live visual software performed w/Santa

↑ index