Skip to content

Instantly share code, notes, and snippets.

View fapestniegd's full-sized avatar

James S White fapestniegd

View GitHub Profile
#!/usr/bin/perl
use strict;
use YAML;
use WWW::Mechanize;
use Data::Dumper;
my $m= WWW::Mechanize->new(agent => 'WWW-Mechanize/1.34', cookie_jar => {});
$m->get( "https://www.linode.com/members" );
if($m->success()){
print "Got page... Logging in with [ $ENV{'LINODE_USERID'} : $ENV{'LINODE_PASSWD'} ]\n";
#!/usr/bin/perl
use Data::Dumper;
use FileHandle;
use YAML;
use WWW::Mechanize;
################################################################################
# This is an added kludge to work around the some behavior between linode and
# www::mechanize, where it just stopped getting the session cookie from the
# linode.com authentication page. You have to download the Export Cookies
# freyr <-> thor 00, 30
# freyr <-> odin 15, 45
# thor <-> odin 05, 35
# thor <-> freyr 20, 50
# odin <-> freyr 10, 40
# odin <-> thor 25, 55
00,30 * * * * [ "$(/bin/hostname -f)" == "freyr.websages.com" ] && /usr/bin/unison /opt/auto ssh://thor.websages.com//opt/auto -batch >> /var/log/unison.log
05,35 * * * * [ "$(/bin/hostname -f)" == "thor.websages.com" ] && /usr/bin/unison /opt/auto ssh://odin.websages.com//opt/auto -batch >> /var/log/unison.log
10,40 * * * * [ "$(/bin/hostname -f)" == "odin.websages.com" ] && /usr/bin/unison /opt/auto ssh://freyr.websages.com//opt/auto -batch >> /var/log/unison.log
gpg --keyserver pgp.mit.edu --recv-keys E8FDD50D46940910
gpg --export -a E8FDD50D46940910 | apt-key add -
grep "deb http://apt.websages.com etch-wcyd main" /etc/apt/sources.list || \
echo "deb http://apt.websages.com etch-wcyd main" >> /etc/apt/sources.list
apt-get update
loki:/opt/local/src# apt-cache search sphinxsearch
sphinxsearch - Sphinx is a full-text search engine.
loki:/opt/local/src# apt-cache show sphinxsearch
#
# LDAP Public Key Patch schema for use with openssh-ldappubkey
# Author: Eric AUGE <eau@phear.org>
#
# Based on the proposal of : Mark Ruijter
#
# octetString SYNTAX
attributetype ( 1.3.6.1.4.1.24552.500.1.1.1.13 NAME 'sshPublicKey'
#!/bin/bash
################################################################################
# de-duplicate all data under the ${BACKUPS} directory
# by hard-linking it to ${CASDIR}/<file's sha1sum>
################################################################################
BASE="/dedupe"
BACKUPS="${BASE}/backups"
CAS="${BASE}/backupcas"
if [ ! -d "${CAS}" ];then mkdir -p "${CAS}"; fi
for FQDN in $(ls ${BACKUPS});do
ldapsearch -xH ldaps://odin.websages.com:636 -b "ou=People,dc=websages,dc=com" -D "${LDAP_BINDDN}" -w "${LDAP_PASSWD}" "(uid=whitejs)" | tr '\n' '%'| sed -e 's/% //g'| tr '%' '\n' | grep "^sshPublicKey::"| awk '{print $2}'| perl -MMIME::Base64 -le 'print decode_base64(<STDIN>);'
class base {
$packagePkgs = [ "apt", "apt-doc", "apt-utils", "debtags", "dpkg", "dpkg-dev" ]
$buildPkgs = [ "binutils", "build-essential", "cpp", "cpp-4.1", "g++", "g++-4.1", "gcc", "gcc-4.1","patch" ]
$nagiosPkgs = [ "nagios3", "nagios-nrpe-server", "nagios-plugins", "nagios-plugins-basic", "nagios-plugins-standard", "snmp" ]
$ldapPkgs = [ "libnss-ldap", "libpam-ldap", "nscd", "ldap-utils" ]
$perlPkgs = [ "perl", "perl-base", "perl-doc", "perl-modules" ]
$pythonPkgs = [ "python", "python2.5", "python2.5-minimal", "python-apt", "python-central", "python-minimal", "python-setuptools" ]
$cifsPkgs = [ "samba-common", "smbclient", "smbfs" ]
$utilPkgs = [ "bc", "bzip2", "console-setup", "console-terminus", "console-tools", "less", "screen", "sudo" ]
$netutilPkgs = [ "iproute", "ethtool", "fping" ]
# code
print STDERR "ssh -o StrictHostKeyChecking=no root\@$self->{'ipaddress'} $remote_command\n";
system qq(ssh -o StrictHostKeyChecking=no root\@$self->{'ipaddress'} \'$remote_command\');
# output
ssh -o StrictHostKeyChecking=no root@174.129.149.251 umask 377 && echo oHkKEaSbmEKmcYEG > /etc/ldap/ldap.secret
Warning: Permanently added the RSA host key for IP address '174.129.2.73' to the list of known hosts.
#!/bin/sh
screencreate(){
if [ -f ~/.screenrc.${UNIQUE} ]; then
screen -S ${UNIQUE} -c ~/.screenrc.${UNIQUE}
else
screen
fi
exit 0;
}