Skip to content

Instantly share code, notes, and snippets.

@larsen
larsen / gist:983354
Created May 20, 2011 17:19
Skype mute toggle
set front_app to (path to frontmost application as Unicode text)
tell application "System Events"
tell application "Skype" to activate
keystroke "M" using {command down, shift down}
end tell
tell application front_app to activate
@larsen
larsen / mute.applescript
Created May 20, 2011 17:20
Skype mute/unmute via menu invocation
on run argv
set front_app to (path to frontmost application as Unicode text)
tell application "Skype" to activate
menu_click({"Skype", "Conversations", (item 1 of argv) & " Microphone"})
tell application front_app to activate
end run
-- http://hints.macworld.com/article.php?story=20060921045743404
-- `menu_click`, by Jacob Rus, September 2006
my $strlenght = 88 ;
my $i = 0 ;
OUTER: for (my $w = 0 ; $w < $img->width ; $w++ ) {
for (my $h = 0 ; $h < $img->height ; $h++ ) {
my ($r, $g, $b) = $img->rgb($img->getPixel($w, $h)) ;
last OUTER if ($i eq $strlength);
my $rbit = $r & 0x01 ;
my $gbit = $g & 0x01 ;
my $bbit = $b & 0x01 ;
" 5.5. How do I configure Vim to open a file at the last edited location?
" Vim stores the cursor position of the last edited location for each buffer
" in the '"' register. You can use the following autocmd in your .vimrc or
" .gvimrc file to open a file at the last edited location:
au BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g`\"" |
\ endif
xyplot(
Perl + Bourne.Shell ~ 1:nrow(sloc),
data = sloc,
type = 'a',
auto.key = list( space = "top", lines = TRUE, points = FALSE)
)
# siamo in un contesto in cui nello
# scope c'e` $self
my $sh = sub {
$self->... # $self e` usabile
# il resto come solito
my ($p, $el, %atts) = @_;
@larsen
larsen / csv_stream_example.pl
Created September 21, 2011 20:01
wishful thinking #csv
Example 1
use CSV::Stream;
use CSV::Stream::Column;
my $planets_stream = CSV::Stream->new(
columns => [
CSV::Stream::Column->new( name => 'Name' ),
CSV::Stream::Column->new( name => 'Distance' ),
CSV::Stream::Column->new(
while ( my $row = $csv->readline( $fh )) {

	test
	
	my ( $field_1,
		 $field_2,
		 ...
		 $field_n ) = @$row;

... do something interesting with the fields ...

package TestConn;
use Dancer ':syntax';
use DBI;
my $dbh = DBI->connect( ... );
our $VERSION = '0.1';
get '/' => sub {
my $sth = database->prepare( "...");
[DEV] larsen [~/src/hakyll-test/hakyll-examples/brochure] (master)
[12:41:28] (22) ghc --make hakyll.hs
Hakyll.hs:1:1:
File name does not match module name:
Saw: `Main'
Expected: `Hakyll'