Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
echo ""
echo "$(tput setaf 3) ########### This bash script is created by UpUbuntu.com ###########$(tput sgr0)"
sleep 2
echo ""
echo ""
echo "$(tput setaf 3) ########### Kernel 3.7 will be installed in an `uname -i` system ###########$(tput sgr0)"
@mrmichalis
mrmichalis / ping.sh
Last active December 10, 2015 22:18
The Story of the PING Program - source for "ping.shar" code from: http://ftp.arl.army.mil/~mike/ping.html
# This is a shell archive. Remove anything before this line, then
# unpack it by saving it in a file and typing "sh file". (Files
# unpacked will be owned by you and have default permissions.)
#
# This archive contains:
# Makefile ping.1 ping.c ping.shar newping.1 newping.c
echo x - Makefile
cat > "Makefile" << '//E*O*F Makefile//'
# Revised to compile under SunOS 4.1.x (no longer necessary to install
@mrmichalis
mrmichalis / start_pg.sh
Created January 8, 2013 17:18
OSX Shell script to start and stop PostgreSQL
#!/usr/bin/env bash
# usage
# sudo -u postgres bin/pg_ctl $1 -D $DATADIR
PG_DIR=$(dirname $(locate pg_ctl | head -n 1))
DATADIR=/Library/PostgreSQL/9.2/data
STATUS=$(sudo -u postgres $PG_DIR/pg_ctl status -D $DATADIR)
if [ $# -lt 1 ]; then
echo "Usage : $0 [start|stop|status]"
#!/bin/bash
cd /home/$1/backups/
mkdir mysql
suffix=$(date +%y%m%d)
MYSQL="$(which mysql)"
databases="$($MYSQL -u $1 -p$2 -Bse ‘show databases’)"
for database in $databases
do
echo "Processing database $database"
mysqldump –opt -u$1 -p$2 ${database} > mysql/${database}.$suffix.sql
@mrmichalis
mrmichalis / OpenMarine.java
Last active December 10, 2015 13:58
(WORK IN PROGRESS) XML hierarchy using jdom2 - for Open Marine XML v2.0 http://wiki.openmarine.org/index.php/OpenMarineXML_Version_2.0
import java.io.*;
import org.jdom2.*;
import org.jdom2.filter.Filters;
import org.jdom2.input.*;
import org.jdom2.output.XMLOutputter;
import org.jdom2.xpath.XPathExpression;
import org.jdom2.xpath.XPathFactory;
import javax.print.attribute.standard.DateTimeAtCompleted;
@mrmichalis
mrmichalis / Main.java
Last active December 10, 2015 12:38
02/01/2012 Example Java XPath parsing and setting using org.dom2 http://www.jdom.org/
import java.io.*;
import org.jdom2.*;
import org.jdom2.filter.Filters;
import org.jdom2.input.*;
import org.jdom2.output.XMLOutputter;
import org.jdom2.xpath.XPathExpression;
import org.jdom2.xpath.XPathFactory;
import java.io.File;
import java.util.List;
import java.util.*;