It’s probably a pretty bad idea to have your site go down, when people are supposed to read the blog post explaining the hack.
Notice how another site reporting the hack received more attention than Twitter’s own announcement. Why was that?
It’s probably a pretty bad idea to have your site go down, when people are supposed to read the blog post explaining the hack.
Notice how another site reporting the hack received more attention than Twitter’s own announcement. Why was that?
| ## Install a necessary packages | |
| $ sudo apt-get install kvm cloud-utils genisoimage | |
| ## URL to most recent cloud image of 12.04 | |
| $ img_url="http://cloud-images.ubuntu.com/server/releases/12.04/release" | |
| $ img_url="${img_url}/ubuntu-12.04-server-cloudimg-amd64-disk1.img" | |
| ## download the image | |
| $ wget $img_url -O disk.img.dist | |
| ## Create a file with some user-data in it |
| require "rubygems" | |
| require "twitter" | |
| require "json" | |
| # things you must configure | |
| TWITTER_USER = "your_username" | |
| MAX_AGE_IN_DAYS = 1 # anything older than this is deleted | |
| # get these from dev.twitter.com | |
| CONSUMER_KEY = "your_consumer_key" |
| package main | |
| /* | |
| Ping vs Pong: A Gladiatorial Match | |
| Two goroutines enter, only one leaves... | |
| */ | |
| /* | |
| #cgo LDFLAGS: -lprobes -L/usr/local/lib | |
| #include "probes.h" |
| # 1) to save all frames from (-i INPUT_VIDEO) input video file, | |
| # (-ss 00:10:00) started at 10 minute and (-t 10) stop after 10 seconds, | |
| # (-same_quant) use same quantizer as source (-f image2) with image2 muxer and | |
| # (img-%04d.jpg) img-0001.jpg pattern | |
| # | |
| # - you get bunch of files | |
| ffmpeg -i INPUT_VIDEO -ss 00:10:00 -t 10 -same_quant -f image2 img-%04d.jpg | |
| # 2) to save (-r 6) 6 frames in second |
| #!/bin/bash | |
| # | |
| # Quickly get a PID for a given process name. | |
| # | |
| if [ $# -lt 1 ]; then | |
| echo 'Usage: pidof <command name>' >&2 | |
| exit 1 | |
| fi | |
| lines=`ps aux -c | grep "$1" | sed -e 's/^[^0-9]*\([0-9]*\).*/\1/g'` |
| /** | |
| * | |
| * Find the relative file system path between two file system paths | |
| * | |
| * @param string $frompath Path to start from | |
| * @param string $topath Path we want to end up in | |
| * | |
| * @return string Path leading from $frompath to $topath | |
| */ | |
| function find_relative_path ( $frompath, $topath ) { |
So, to get something like /etc/rc.local you can use the custom SMF import facility. (See the source
for more information about how this actually works.)
/opt is mounted out of zones/opt by default. You can create a directory /opt/custom/smf and populate it with SMF manifests. Any manifests you put in there will be imported by SmartOS when it boots. Below is an example SMF manifest that simply starts /opt/custom/bin/postboot, a self-explanatory shell script that you can use like /etc/rc.local.
Note that it would likely be better to customise and respin your own images, as putting a bunch of platform state in the zones pool undoes some of the benefits of the ramdisk platform architecture that SmartOS has.
| #!/bin/sh -xe | |
| API_KEY="YOUR_API_KEY_GOES_HERE" | |
| FPS="10" | |
| VLC_PATH="/Applications/VLC.app/Contents/MacOS/VLC" | |
| # I don't know how this'll behave on multimon, so you might want to hard-code. | |
| # INRES='1440x900' | |
| INRES=$(osascript -e 'tell application "Finder" to get bounds of window of desktop'|sed 's/, /x/g'|cut -f3- -dx) | |
| OUTRES='1280x800' | |
| # You can change this to record microphone or something else, from man soxformat (under coreaudio): |
| #!/usr/bin/env sh | |
| ## | |
| # This is script with usefull tips taken from: | |
| # https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
| # | |
| # install it: | |
| # curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
| # |