Skip to content

Instantly share code, notes, and snippets.

View BlackMaria's full-sized avatar
💭
hating social media and public status indicators

Hroðgar Skjöldung BlackMaria

💭
hating social media and public status indicators
  • 3rd planet left of the yellow one
View GitHub Profile
@BlackMaria
BlackMaria / pdf_merge.sh
Created May 24, 2013 20:53
I use this all the time. d to a dir and create one pdf from all of the pdf's in that dir ( or use it in the command line, which is what I do ).
#!/bin/sh
pdf=*.pdf
gs -q -sPAPERSIZE=letter -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=pdfmerged.pdf $pdf
# yeah!!!!
@BlackMaria
BlackMaria / tick_eumlator.rb
Last active December 17, 2015 17:29
A simple linear function used to emulate accumulative ticks during a day ( 6am-6am). Code outputs two values +30% and the estimated ticks water marks. This is by first ruby code :)
#!/usr/bin/env ruby
#
# The idea here is, tick is almost a linear function. We really want a
# tick_function and compare based on time of day, but this will do for now.
#
# We can almost determine the typical linear increase of errors
# based on time of day. So here we assume that the linear starts
# at 6am and increases until 6am the next day.
#
# NB: One flaw is that the values are less relevant before noon :}
@BlackMaria
BlackMaria / install_xcat.sh
Last active December 17, 2015 17:29
I typically run something like this after a fresh install
#!/bin/sh
# I typically run something like this after a fresh install
########################################
# What DISTRO are we installing on
########################################
release=rh6
ARCH=x86_64
DISTRO=centos6.4
ISO_DISTRO=CentOS6.4
@BlackMaria
BlackMaria / mod_xcat2mysql.sh
Created May 24, 2013 20:15
Configure xcat to use mysql rather than sqlite. Note if you haven't changed your mysql root passwd you should read code for more info.
#!/bin/sh
MANAGMENTNODE=xcat
# passwords used in script
# root password for mysql
# ( if using user other than root modify below )
SQL_ROOT_PASS=rootpw
# The password used by xcat
# ( you dont need to know this unless you decied to debug mysql )
XCAT_PASS=xcat_user_passwd
#
@BlackMaria
BlackMaria / get_centos_iso4xcat.sh
Created May 24, 2013 20:00
Getting new CentOS ISO's for a fresh install on xcat. NB I use a monthly rsync for all mirrors
DISTRO=centos6
DISTRO_VERS=6.4
ISO_ARCH=x86_64
ISO_DISTRO=CentOS-${DISTRO_VERS}
RPM_MIRRIR=http://centos.mirror.iweb.ca
getisos(){
for i in 1 2
do
# http://centos.mirror.iweb.ca/6.4/isos/x86_64/CentOS-6.4-x86_64-bin-DVD1.iso
wget ${RPM_MIRRIR}/${DISTRO_VERS}/isos/${ISO_ARCH}/${ISO_DISTRO}-${ISO_ARCH}-bin-DVD${i}.iso
@BlackMaria
BlackMaria / mk_xcat_esx_node.sh
Last active March 23, 2021 23:05
The following is the quick and dirty template example of what I do when creating vmware nodes in xcat. If you are not using pxe nor vmware just exclude that line ( but it wont break anything if you keep it )
#!/bin/sh
# define vaiables
# In my real set up this is a lot more complex but if you are new to xcat
# this should be useful enought to get started
HOST_NAME=nodename
mac=00:50:56:b0:d0:00
ip=192.168.13.16
XCAT=192.168.13.100
OS=centos6
@BlackMaria
BlackMaria / mk_statelss_xcat_node.sh
Created May 24, 2013 19:39
This is an example of how I start to create a new stateless image
#!/bin/sh
# CREATE XCAT STATLESS IMAGE
# -- note you can not make a statless image for a distro other than the one this script is running on
# -- That is various tools will fail if you try to build fedora on centos, or centos6.1 on centos6.4
#
# Setup DISTRO Variables
DIST=`lsb_release -i | cut -d: -f2 | sed 's/\s//g' `
REL=`lsb_release -r | cut -d: -f2 | sed 's/\s//g' `
MAJ=`echo $REL | cut -d. -f1 | sed 's/\s//g' `
release=rh$MAJ
@BlackMaria
BlackMaria / tarpm.sh
Last active December 17, 2015 03:08
Just another silly hack. I needed some files from a package, but the package was removed from the mirror! POW!
#!/bin/sh
#
# Some times you jsut want the files from an installed package...
#
for package in $( rpm -qa |egrep $1 )
do
rpm -ql $package | xargs tar -czvf $package.tgz
done
@BlackMaria
BlackMaria / remote_wireshark.sh
Created May 8, 2013 13:04
How to use look at traffic form a remote system, piping a remote tcpdump to a local wireshark session.
#!/bin/sh
REMOTE_SYSTEM=$1
# You want to filter out your ssh pipe from tcpdump.
# So we need to know what our IP is that is connecting to the system
# IF behind a firewall you will want to fix this
#
# There are more elegant ways than this, I just can remember them :}
# LOCAL_IP=$(ifconfig |grep 192 | cut -d: -f2 | cut -d\ -f1)
#
@BlackMaria
BlackMaria / AutoFS_example.sh
Last active December 17, 2015 02:59
Here is a quick script to get you started using AutoFS, with some minor explanation.
#!/bin/sh
#
#
# The following will Install autofs and create an AutoFS config that
# will mount SERVER:/EXPORT on MOUNT_POINT/$MOUNTNAME
#
# OPTION:
# You can also add all subdirs of a mount by adding a trailing "&"
# The following will mount each dir under /nfs/disks/ discreetly
# disks -rw server:/nfs/disks/&