Skip to content

Instantly share code, notes, and snippets.

@leedo
leedo / gist:1732feab61acd7f626c8
Last active August 29, 2015 14:01
echo '¯\_(ツ)_/¯' | perl -CS -MUnicode::UCD=charinfo -MData::Dump=pp -lnE 'say join "\n", map {$_, pp charinfo ord $_} split ""'
¯
{
bidi => "ON",
block => "Latin-1 Supplement",
category => "Sk",
code => "00AF",
combining => 0,
comment => "",
decimal => "",
decomposition => "<compat> 0020 0304",
@leedo
leedo / gist:d70ea20db96008dbbd24
Last active August 29, 2015 14:05
Update bike on Strava activities
#!/usr/bin/env perl
use v5.20;
use feature 'signatures';
use AnyEvent;
use AnyEvent::HTTP;
use AnyEvent::HTTPD;
use JSON::XS;
use URI;
@leedo
leedo / i3-window-warp.pl
Created January 31, 2015 21:29
bindsym $mod+j exec --no-startup-id i3-window-warp left
#!/usr/bin/env perl
use AnyEvent;
use AnyEvent::I3 ":all";
my $i3 = i3();
$i3->connect->recv or die "Error connecting";
my $direction = shift or die "need direction";
my $cv = AE::cv;
@leedo
leedo / i3-window-warp
Created January 31, 2015 21:54
bindsym $mod+j exec i3-window-warp focus left
#!/usr/bin/env perl
use AnyEvent;
use AnyEvent::I3 ":all";
my $i3 = i3();
$i3->connect->recv or die "Error connecting";
my $command = join(" ", @ARGV) or die "need command";
my $cv = AE::cv;
#!/bin/bash
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m'
for dir in $(find "$1" -maxdepth 1 -type d); do
if [ -d "$dir/.git" ]; then
dirty=$(git -C "$dir" diff --shortstat 2> /dev/null | tail -n 1)
if [[ $dirty != "" ]]; then
sub _serverName {
my $self = shift;
my $row = shift;
return (length($row->{'inventory_tag'})
? $row->{'inventory_tag'}
: (length($row->{'hostname'})
? $row->{'hostname'}
: (length($row->{'rack_id'})
? $row->{'rack_id'}
: (length($row->{'nickname'})
#!/usr/bin/perl
use Regexp::Grammars;
use File::Slurp;
use Data::Dump qw/dump/;
my $config = read_file $ARGV[0];
my $parser = qr{
<[Item]>+
onCmdC: function(event) {
if (!this.activeWindow.input.focused) {
this.activeWindow.input.cancelNextFocus();
}
},
onCmdK: function() {
this.activeWindow.messages.update("");
this.activeWindow.lastNick = "";
},
@leedo
leedo / gist:213500
Created October 19, 2009 16:33
alice frontend using seed
#!/usr/bin/env seed
Gtk = imports.gi.Gtk;
Glib = imports.gi.GLib;
WebKit = imports.gi.WebKit;
os = imports.os;
Gtk.init(Seed.argv);
window = new Gtk.Window({title: "Alice"});
$$('head script[src]').findAll(function(s) {
return s.src.match(js);
}).each(function(s) {
var params = s.src.match(js)[1];
params.split("&").each(function(o) {
var kv = o.split("=");
options[kv[0]] = kv[1];
});
});