Skip to content

Instantly share code, notes, and snippets.

Quick setup — if you’ve done this kind of thing before
or
Get started by creating a new file or uploading an existing file. We recommend every repository include a README, LICENSE, and .gitignore.
…or create a new repository on the command line
Optional
git clone ...
end
# Magic variables: __FILE__, __DIR__, __BASE__, __ROOT__
bashSource="${BASH_SOURCE[0]}"
while [ -h "${bashSource}" ]; do
if [[ "${bashSource}" == /* ]]; then
bashSource="$(readlink "${bashSource}")"
else
bashSource="$(dirname "${bashSource}")/$(readlink "${bashSource}")"
fi
done
__FILE__="${bashSource}"
@kpietru
kpietru / expect_install_mysql.sh
Last active August 29, 2015 14:24
Expect inside shell + install mysql-server + variables
#!/bin/bash
MYSQL_PASSWORD="pass"
export MYSQL_PASSWORD="$MYSQL_PASSWORD"
# Debug
#expect -D 1 -c '
expect -c '
spawn apt-get install -y mysql-server
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "<!DOCTYPE html>\n";
print "<html>\n";
print " <head>\n";
print " <title>Perl</title>\n";
print " </head>\n";
print " <body style=\"backgorund-color: #fff; color: #333; font-family: arial, helvetica, sans-serif;\">\n";
print " <h1>Perl</h1>\n";
print " <p style=\"white-space: pre-wrap;\">\n";