Skip to content

Instantly share code, notes, and snippets.

View frioux's full-sized avatar

fREW Schmidt frioux

View GitHub Profile
module Ghetto;
sub run($cmd) {
# create a random filename to store output in
my $tmp = ".tmp-{(1..100).pick}-ghetto";
# use the real run command, :: means root namespace
::run("$cmd > '$tmp'");
# open the file
View fru2m3u.pl6
use Ghetto;
for =$*IN -> $track,$artist,$album,$sep {
my $cmd = qq{dcop amarok collection query "SELECT url FROM tags JOIN artist ON = artist JOIN album ON = album WHERE = \\"$artist\\" and = \\"$album\\" and title = \\"$track\\""};
# this insanity is to take the first character off because amaroK adds a
# . to the front of all the file names. There's probably a better way
# to do this.
say Ghetto::run($cmd).split("\n")[0].reverse.chop.reverse;
View m3u2fru.pl6
use Ghetto;
for =$*IN -> $line {
unless $line ~~ /^\#/ {
my $file = $line.split('/').pop;
my $cmd = qq{dcop amarok collection query "SELECT title,, FROM tags JOIN artist ON = artist JOIN album ON = album WHERE url LIKE \\"%/$file\\""};
my ( $track,$artist,$album ) = Ghetto::run($cmd).split("\n");
frioux / gist:1172717
Created August 26, 2011 04:46
Why even being in #p5p is not worth my time
View gist:1172717
< frew> does anyone think that it would be worthwhile to implement a pure perl implementation of the various POSIX functions that are fallbacks?
< frew> it seems like it would mostly be SMOP and it would really help at least me :-)
< frew> (win32 boo)
<@LeoNerd> Which functions did you have in mind?
< frew> well I just ran into WEXITSTATUS
<@Steve_p> That was done, wasn't it?
< frew> and I had an issue with the date formatting a while ago
<@LeoNerd> strftime?
<+purl> hmmm... strftime is in or possibly *very* useful for formatting dates or %Y%m%d is what you want
< frew> yessir
frioux / gist:3220451
Created July 31, 2012 20:55
<3 correlated subqueries
View gist:3220451
SELECT [me].[id], [me].[name], [me].[group_id], [me].[user], [me].[version], [me].[is_active], [key_server_side_mia], [button_server_side_mia], [messenger_server_side_
mia], [key_pro_server_side_mia], [key_status], [button_status], [messenger_status], [key_pro_status], [is_group_active], [last_checkin], [macro]
SELECT [me].[id], [me].[name], [me].[group_id], [me].[user], [me].[version], [me].[is_active], [key_server_side_mia], [button_server_side_mia], [messenger_server_s
ide_mia], [key_pro_server_side_mia], [key_status], [button_status], [messenger_status], [key_pro_status], [is_group_active], [last_checkin], [macro], ROW_NUMBER() OVE
R (
) AS [rno__row__index]
frioux / gist:4288396
Created December 14, 2012 20:27
weird bug in union I think
View gist:4288396
.:15:24:31:. <geoff> which, I had an interesting time meshing that union with correlated_resultset,
.:15:24:41:. frew I made a thing that will correctly sort on a correlated column when the user asks to
.:15:24:51:. frew oh?
.:15:24:52:. frew why?
.:15:24:53:. <geoff> oooo
.:15:24:58:. <geoff> I just had to do
.:15:25:05:. <geoff> $rs1->with_correlation
.:15:25:10:. <geoff> and $rs2->with_correlation
.:15:25:13:. <geoff> then union
frioux /
Last active January 14, 2016 19:47
replacement Plack::App::WrapCGI (perl only)
package Plack::App::WrapCGI;
use strict;
use warnings;
use parent qw(Plack::Component);
use Plack::Util::Accessor qw(script execute _app);
use File::Spec;
use CGI::Emulate::PSGI;
use CGI::Compile;
use Carp;
use POSIX ":sys_wait_h";
frioux / gist:7173878
Created October 26, 2013 20:06
Home dir organization
View gist:7173878
  • code - source code checkouts (maybe split this up based on if it's my project or not?)
  • media/Music - symlink to music drive/partion
  • media/Games and .local/share/Steam - symlink to games drive/partition
  • tmp - working space for extracting tarballs to, etc. ram partition
  • no Downloads! Things get downloaded to either tmp, or Dropbox
  • Dropbox - articles, private code, books, weird drivers, etc (to be organized very similarly to home dir)
  • mnt - servers or media shares I mount regularly
  • bin - my various binaries (most are in code/dotfiles/bin or Dropbox/bin though)
  • .config - non-dotfile configs (vpn config, etc)
  • var/Mail - email
frioux / query.sql
Last active January 4, 2016 20:49
Query tuning (4b7216a)
View query.sql
SELECT [me].[id], [me].[site], [me].[channel], [me].[subject], [me].[message], [me].[date], [me].[description], [me].[context], (
FROM [LogChildren] [children_alias]
JOIN [LogStatus] [statuses]
ON [statuses].[child_id] = [children_alias].[id]
WHERE [statuses].[success] = '0' AND [children_alias].[parent_id] = [me].[id]
), (
FROM [LogChildren] [children_alias]
JOIN [LogStatus] [statuses]

Keybase proof

I hereby claim:

  • I am frioux on github.
  • I am frew ( on keybase.
  • I have a public key whose fingerprint is 2896 7E7B F03D B43E 5A43 3430 6EB3 302F 737A 7582

To claim this, I am signing this object: