Skip to content

Instantly share code, notes, and snippets.

View trapd00r's full-sized avatar
🐫
japh

magnus woldrich trapd00r

🐫
japh
View GitHub Profile
#!/usr/bin/perl
# Find similar artists POC
# trapd00r 2010
use strict;
use warnings;
use Audio::MPD;
use LWP::Simple;
my $mpd = Audio::MPD->new;
# this was a oneliner before github fucked it up >_<
# rips all tracks from url and saves them like artist - title.mp3
curl http://www.vkgoeswild.com/\?section\=mp3\&songs\=1 | grep '<li><a href="downloads.php3'|perl -pe 's/<\/a>/\n/g'|perl -pe 's/^<.+\?song=//g'|perl -pe 's/">/,/'|perl -pe '%h=();while(<>){my($id,$name) = split /,/; $h{$id} = $name;}print "$_\n" for keys %h;my $burl="http://www.vkgoeswild.com/?section=mp3&songs=1";use WWW::Mechanize; my $m=WWW::Mechanize->new;$m->get($burl);foreach my $song($m->links){if($song->url_abs =~ /.+song=([0-9]+)$/) {my $id = $1;my $fname = $h{$id}.$id.".mp3";$m->follow_link(url => $song->url); print "Saving ". $song->url, " to ", "$fname\n";$m->save_content($fname);$m->back;}}'
curl -s http://www.archlinux.org/news/ | grep '<td>'|head -2|perl -pe 'chomp;s;^\s+<td>(.+)</td>;$1: ;'|perl -pe 's/<a href.+">(.+)<.+/$1\n/'
perl -e '@i=`pacman -Qi`;for(@i){if(/Name\s+:(.+)/){$n=$1;}if(/Installed Size\s+:(.+) K/){$s=$1;}$w{$n}=$s;}for$f(sort{$w{$a}<=>$w{$b}}(keys(%w))){printf("\033[31m%8d\033[0mK %s\n",$w{$f},$f);}'
LS_COLORS="*.tar.bz2=38;5;226:*.tar.xz=38;5;130:*.baz=48;5;233;38;5;38:*.bar=48;5;233;38;5;226:*.foo=48;5;233;38;5;160:*.html=38;5;213:*.htm=38;5;213:*.vim=38;5;142:*.vimp=38;5;178:*.css=38;5;209:*.screenrc=38;5;120:*.procmailrc=38;5;120:*.vimperatorrc=38;5;120:*.zshrc=38;5;120:*.bashrc=38;5;120:*.xinitrc=38;5;120:*.vimrc=38;5;120:*.toprc=38;5;120:*.stumpwmrc=38;5;120:*.muttrc=38;5;120:*.msmtprc=38;5;120:*.gtkrc-2.0=38;5;120:*.fehrc=38;5;120:*.rc=38;5;120:*.md=38;5;130:*.markdown=38;5;130:*.conf=38;5;148:*.h=38;5;81:*.rb=38;5;192:*.c=38;5;110:*.diff=42;38:*.yml=38;5;208:*.PL=38;5;178:*.csv=38;5;136:tw=38;5;003:*.chm=38;5;144:*.bin=38;5;249:*.sms=38;5;33:*.pdf=38;5;203:*.cbz=38;5;140:*.cbr=38;5;140:*.nes=38;5;160:*.mpg=38;5;38:*.ts=38;5;39:*.sfv=38;5;191:*.m3u=38;5;172:*.txt=38;5;192:*.log=38;5;190:*.bash=38;5;173:*.swp=38;5;241:*.swo=38;5;240:*.theme=38;5;109:*.zsh=38;5;173:*.nfo=38;5;113:mi=38;5;124:or=38;5;160:ex=38;5;197:ln=target:pi=38;5;130:ow=38;5;208:fi=38;5;007:so=38;5;167:di=38;5;30:*.pm=38;5;197:*.p
#!/usr/bin/perl
use strict;
chomp(my $pwd = `pwd`);
my @chars = split//, $pwd;
my $i = 202;
for my $c(@chars) {
print "\033[38;5;$i"."m".$c;
;; This is to have clx running when sbcl begins, I think
;; Load ASDF first
(require 'asdf)
(pushnew #p"/usr/share/common-lisp/systems/" asdf:*central-registry* :test #'equal)
(asdf:operate 'asdf:load-op 'cl-ppcre)
;; This is supposed to load cl-ppcre, I think
;; Note that ASDF has already been loaded (up above, in the CLX part). If that is not so, uncomment the following line
;(require 'asdf)
print($_->($_))for(sub{return(grep(!m$(?:[b-gik-oq-ty]+)$,split(m;;,qw-jyatopnh-)));});
@trapd00r
trapd00r / gist:856572
Created March 5, 2011 18:24
LS_COLORS
*.torrent=38;5;58:*.mfasl=38;5;73:*.rdf=38;5;144:*.sqlite=38;5;60:*.tdy=38;5;214:*.ogv=38;5;94:*.out=38;5;46;1:*.un~=38;5;240:*.sample=38;5;225;1:*.example=38;5;225;1:*.enc=38;5;110;3:*.map=38;5;58;3:*.mf=38;5;220;3:*.tfm=38;5;64:*.pfb=38;5;64:*.pfm=38;5;64:*.afm=38;5;64:*.def=38;5;136:*.mtx=38;5;36;3:*.tex=38;5;172:*.etx=38;5;36;3:*.sty=38;5;58:*.cfg=1:*.properties=38;5;197;1:*.m4=38;5;196;3:*.tfnt=38;5;140:*.tcl=38;5;64;1:*.typelib=38;5;49:*.pfa=38;5;43:*.sed=38;5;130;1:*.awk=38;5;148;1:*.svg=38;5;24;1:*.ttf=38;5;69;1:*.cpp=38;5;24;1:*.cs=38;5;74;1:*.java=38;5;142;1:*.jsm=38;5;142;1:*.jad=38;5;142:*.jar=38;5;142:*.jhtm=38;5;142:*.jsp=38;5;142:*.ru=38;5;142:*.js=38;5;42:*.jsm=38;5;42:*.lisp=38;5;204;1:*.coffee=38;5;94;1:*.asm=38;5;240;1:*.mp4=38;5;124:*.flv=38;5;131:*.spl=38;5;44:*.sug=38;5;44:*.1=38;5;196;1:*.eps=38;5;192:*.xpm=38;5;32:*.gif=38;5;35:*.info=38;5;101:*.lua=38;5;34;1:*.t=38;5;028;1:*.textile=38;5;106:ln=target:*.hs=38;5;159:*.ini=38;5;122:*.part=38;5;240:*.pid=38;5;160:*.pod=38;5;106:*.vim=1:*
#!/usr/bin/perl
use strict;
use warnings;
# 8bit disco-terminal, by poisonbit.
use List::Util qw/shuffle/;
use Term::ANSIColor qw/:constants/;
use Term::Cap;
use Term::ReadKey;