Skip to content

Instantly share code, notes, and snippets.

View jnbek's full-sized avatar

John D Jones III jnbek

View GitHub Profile
@jnbek
jnbek / openpipes
Created December 20, 2010 02:01
Working example with using open and pipes for external program execution.
perl -e'open my $PROG, "-|", "ls -hal"; while (<$PROG>) { print $_; } close $PROG;'
@jnbek
jnbek / arch.zsh
Created November 11, 2011 01:05
64 bit Arch Desktop
#!/bin/zsh
# Install all the packages for my Arch Linux Installs
yaourt -Syy;
W=(`pacman -Ss gimp | grep -v help | perl -p -i -e 's/^.*\/(.*).+/$1/xs' | sed -e's/\s.*//'`);
X=(`pacman -Ss ttf- | perl -p -i -e 's/^.*\/(.*).+/$1/xs' | sed -e's/\s.*//'`);
Y=(`pacman -Ss gstreamer0.10- | perl -p -i -e 's/^.*\/(.*).+/$1/xs' | sed -e's/\s.*//'`);
PACMAN=( abs ack ati-dri audex aurvote cabextract cdrdao cifs-utils clementine clojure ctags cups customizepkg cvs dnstracer dnsutils dvd+rw-tools easytag enchant faac findutils firefox flac flashplugin fpc fuse fuseiso gdb gdm gecko-mediaplayer geoip ghostscript gimp-help-en git gprolog gramps graphviz guifications gvfs gvfs-afc gvfs-afp gvfs-gphoto2 gvfs-smb gvim htop hunspell hunspell-en icedtea-web-java7 inetutils intel-dri iputils jre7-openjdk k3b kdegraphics-okular kdesdk-kate keychain lame lazarus lib32-ati-dri lib32-intel-dri lib32-nouveau-dri libgnomeui libgpod libreoffice libreoffice-en-US lua luakit mate mate-extras mercurial mesa mlocate multilib-devel net
@jnbek
jnbek / pgsqljail.txt
Created December 6, 2011 04:03
Postgres Jail
I had added this value to /etc/sysctl.conf:
# For PostgreSQL jails
security.jail.sysvipc_allowed=1
I needed to set this in /etc/rc.conf
jail_sysvipc_allow="YES" # For PostgreSQL
@jnbek
jnbek / capture_print_to_fh.pl
Created December 20, 2011 00:02
This captures print output from a sub into a file handle so you can use the data, in a variable (I need an array in this case) cuz sometimes cpanel writes silly code...
#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
sub do_print {
for (keys %ENV) {
print "$_ => $ENV{$_}\n";
}
}
@jnbek
jnbek / gstreamer.zsh
Created February 23, 2012 18:01
Arch Gstreamer Install All
X=(`pacman -Ss gstreamer0.10- | sed -e's/\s.*//'`); yaourt -S $X
@jnbek
jnbek / xfce.zsh
Created February 23, 2012 18:02
Arch Xfce Install All
X=(`pacman -Ss xfce | sed -e's/\s.*//'`); yaourt -S $X
@jnbek
jnbek / all_mods.pl
Created March 8, 2012 15:35
Dump full path to all installed Perl Modules
perl -MFile::Find=find -MFile::Spec::Functions -Tlwe 'find { wanted => sub { print canonpath $_ if /\.pm\z/ }, no_chdir => 1 }, @INC'
@jnbek
jnbek / dump_all_mods.pl
Created March 8, 2012 17:04
Better Dump All Perl Modules Installed
perl -MFile::Find=find -Tlwe 'for $inc (@INC) { find { wanted => sub { return if !/\.pm\z/; ($a=$File::Find::name)=~s|^\Q$inc\E/||; $a =~ s/\//::/g; $a =~ s/(.*)\.pm$//g;print $1 }, no_chdir => 1 }, $inc }'
@jnbek
jnbek / smtp_new.pl
Created March 23, 2012 18:55
all purpose Net::SMTP object constuct, trying SSL first before falling back on non-SSL
my $smtp_connection = $self->{'smtp_obj'} ||= do {
my $smtps_obj = eval {
require Net::SMTP::SSL;
my $s = Net::SMTP::SSL->new(
$args->{'smtp_server'},
Port => 465,
Hello => $mail_domain,
Timeout => 10,
Debug => 0,
);
@jnbek
jnbek / applet.js
Created March 29, 2012 16:04
my removable drives applet
const Lang = imports.lang;
const St = imports.gi.St;
const Cinnamon = imports.gi.Cinnamon;
const Applet = imports.ui.applet;
const Main = imports.ui.main;
const PopupMenu = imports.ui.popupMenu;
function DriveMenuItem(place) {
this._init(place);
}