Skip to content

Instantly share code, notes, and snippets.

@peczenyj
Last active August 29, 2015 13:57
Show Gist options
  • Select an option

  • Save peczenyj/9725430 to your computer and use it in GitHub Desktop.

Select an option

Save peczenyj/9725430 to your computer and use it in GitHub Desktop.

Revisions

  1. peczenyj revised this gist Mar 24, 2014. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion README
    Original file line number Diff line number Diff line change
    @@ -27,4 +27,8 @@ cat.jpg
    $ gimp catfs/cat.jpg # will open a different kitten pic each time

    # after finish the script
    $ fusermount -u catfs
    $ fusermount -u catfs

    Fork if you want:

    https://github.com/peczenyj/catfs
  2. peczenyj revised this gist Mar 24, 2014. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions README
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@
    NEW! you can install via cpan: https://metacpan.org/release/PACMAN/Acme-CatFS-0.001

    1. you should install LWP::Simple and Fuse:Simple - use cpan or cpanm
    2. you should configure the local fuse install to run as root or as common user
    3. don't forget 'fusermount -u <mountpoint>' after finish the script
  3. peczenyj revised this gist Mar 23, 2014. 1 changed file with 9 additions and 0 deletions.
    9 changes: 9 additions & 0 deletions README
    Original file line number Diff line number Diff line change
    @@ -2,6 +2,15 @@
    2. you should configure the local fuse install to run as root or as common user
    3. don't forget 'fusermount -u <mountpoint>' after finish the script

    to install dependencies

    you can use regular cpan OR cpanminus ( http://search.cpan.org/~miyagawa/App-cpanminus-1.7001/lib/App/cpanminus.pm )

    $ cpan LWP::Simple
    $ cpan Fuse:Simple ( maybe you need install via apt-get libfuse-dev too )

    the difference is: cpanminus is more indicate if you want install something without change the default perl instalation in your operational system. 90% of the cases you can install with regular cpan ( built in ).

    to test

    $ chmod +x cats.pl
  4. peczenyj revised this gist Mar 23, 2014. 2 changed files with 20 additions and 1 deletion.
    19 changes: 19 additions & 0 deletions README
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    1. you should install LWP::Simple and Fuse:Simple - use cpan or cpanm
    2. you should configure the local fuse install to run as root or as common user
    3. don't forget 'fusermount -u <mountpoint>' after finish the script

    to test

    $ chmod +x cats.pl
    $ mkdir catfs
    $ ./cats.pl catfs

    # in other terminal

    $ ls catfs
    cat.jpg

    $ gimp catfs/cat.jpg # will open a different kitten pic each time

    # after finish the script
    $ fusermount -u catfs
    2 changes: 1 addition & 1 deletion cats.pl
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    #! perl
    #!/usr/bin/env perl
    use strict;
    use warnings;

  5. peczenyj revised this gist Mar 23, 2014. 1 changed file with 0 additions and 2 deletions.
    2 changes: 0 additions & 2 deletions cats.pl
    Original file line number Diff line number Diff line change
    @@ -17,5 +17,3 @@
    },
    },
    );

    print "don't forget 'fusermount -u $mountpoint'\n";
  6. peczenyj revised this gist Mar 23, 2014. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions cats.pl
    Original file line number Diff line number Diff line change
    @@ -17,3 +17,5 @@
    },
    },
    );

    print "don't forget 'fusermount -u $mountpoint'\n";
  7. peczenyj created this gist Mar 23, 2014.
    19 changes: 19 additions & 0 deletions cats.pl
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    #! perl
    use strict;
    use warnings;

    use LWP::Simple;
    use Fuse::Simple qw(main);

    my $mountpoint = $ARGV[0];

    die "usage: $0 <directory>\n" if ! defined $mountpoint || ! -d $mountpoint;

    main(
    mountpoint => $mountpoint,
    "/" => {
    'cat.jpg' => sub {
    get('http://thecatapi.com/api/images/get?format=src&type=jpg');
    },
    },
    );