This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var loneTalker = {}; | |
var addSpeach = function(name) { | |
var text = 'Hello ' + name; | |
var talk = function() { | |
console.log(text); | |
}; | |
loneTalker.talk = talk; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# after that you need to insert # --- !Ups on top of the generated file | |
echo '# --- !Ups' > conf/evolutions/default/2.sql | |
# column inserts are needed in case of new model properties | |
# we keep only the insert statements, pg_dump comments confuse ebean/play | |
pg_dump --column-inserts \ | |
--inserts --data-only --exclude-table=play_evolutions \ | |
--username popcon -h localhost popcon \ | |
| grep '^INSERT INTO' \ | |
>> conf/evolutions/default/2.sql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# you need to install the libnss3-tools package or equivalent | |
if [ $# -lt 2 ]; then | |
echo "Usage: $0 hostname port" | |
exit 1 | |
fi | |
hostname=$1 | |
port=$2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pct enter 142 | |
ps ax | |
PID TTY STAT TIME COMMAND | |
1 ? Ss 0:00 init [2] | |
831 ? Ss 0:00 /sbin/rpcbind -w | |
951 ? Ssl 0:00 /usr/sbin/rsyslogd | |
1025 ? Ss 0:00 /usr/sbin/atd | |
1071 ? Ss 0:00 /usr/sbin/cron | |
1086 ? Ss 0:00 /usr/bin/dbus-daemon --system |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class amanda { | |
package { "amanda-client": | |
ensure => installed, | |
before => File['/etc/amandahosts'], | |
} | |
file { "/etc/amandahosts": | |
ensure => file, | |
owner => "backup", | |
group => "backup", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
[ -d /var/backups/vhosts ] || mkdir /var/backups/vhosts | |
VHOST_DIR=/srv/www/ | |
cd $VHOST_DIR | |
for VHOST in *; do | |
if [ "$VHOST" != "basebox.libera.cc" ]; then | |
tar cpzf /var/backups/vhosts/$VHOST.tar.gz $VHOST |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
su -l postgres -c /usr/local/sbin/backup_postgres | |
# a nice comment |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# to be run as postgres user | |
# a database should be restored as posgres user with | |
# dropdb popcon | |
# createdb --encoding=UNICODE --owner=popcon popcon | |
# psql popcon < popcon.psql | |
set -e | |
do_bkp() { | |
/usr/bin/pg_dump -U postgres --column-inserts --file=/var/backups/postgres/$i.psql $i |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create a temporary inventory file | |
echo "vagrant ansible_ssh_host=localhost ansible_ssh_user=vagrant ansible_ssh_port=2222" > hosts | |
# run a root shell in the vagrant env | |
ansible \ | |
--inventory hosts \ | |
--private-key=/opt/vagrant/embedded/gems/gems/vagrant-1.2.7/keys/vagrant \ | |
--sudo \ | |
--args "id" vagrant |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
export OS=Debian7 | |
virt-install \ | |
--connect qemu:///system \ | |
--name ${OS} \ | |
--ram 512 \ | |
--vcpus 1 \ | |
--file ${OS}.img \ |