start new:
tmux
start new with session name:
tmux new -s myname
| # HOW TO INSTALL JANUS | |
| curl -Lo- http://bit.ly/janus-bootstrap | bash | |
| #errored out...had to install git first, derrr | |
| sudo apt-get install git | |
| curl -Lo- http://bit.ly/janus-bootstrap | bash | |
| # error! had to install rake next | |
| sudo apt-get install rake | |
| curl -Lo- http://bit.ly/janus-bootstrap | bash |
| # (I recommend understanding the basics of this first: http://sequel.jeremyevans.net/rdoc/files/doc/object_model_rdoc.html) | |
| # Extending the underlying dataset (http://sequel.jeremyevans.net/rdoc/files/README_rdoc.html#label-Extending+the+underlying+dataset) | |
| # The recommended way to implement table-wide logic by defining methods on the dataset using dataset_module: | |
| class Post < Sequel::Model | |
| dataset_module do | |
| def posts_with_few_comments | |
| where{num_comments < 30} |
| #!/bin/bash | |
| # Stop all containers | |
| docker stop $(docker ps -a -q) | |
| # Delete all containers | |
| docker rm $(docker ps -a -q) | |
| # Delete all images | |
| docker rmi $(docker images -q) |
| #Spider Websites with Wget – 20 Practical Examples | |
| Wget is extremely powerful, but like with most other command line programs, the plethora of options it supports can be intimidating to new users. Thus what we have here are a collection of wget commands that you can use to accomplish common tasks from downloading single files to mirroring entire websites. It will help if you can read through the wget manual but for the busy souls, these commands are ready to execute. | |
| 1. Download a single file from the Internet | |
| wget http://example.com/file.iso | |
| 2. Download a file but save it locally under a different name | |
| wget ‐‐output-document=filename.html example.com |
| #!/usr/bin/env ruby | |
| # | |
| # = Email Ping | |
| # | |
| # Check to see if an email address exists by looking up MX records and connecting | |
| # to the address's home SMTP server. It then starts to send a message to the address | |
| # but quits before the message is actually sent. | |
| require 'resolv' | |
| require 'net/smtp' |
| #!/usr/bin/env ruby | |
| ADDED_OR_MODIFIED = /^\s*(A|AM|M)/.freeze | |
| changed_files = `git status --porcelain`.split(/\n/) | |
| unstaged_files = `git ls-files -m`.split(/\n/) | |
| changed_files = changed_files.select { |f| f =~ ADDED_OR_MODIFIED } | |
| changed_files = changed_files.map { |f| f.split(" ")[1] } |
| Backup: | |
| docker exec -t -u postgres your-db-container pg_dumpall -c > dump_`date +%d-%m-%Y"_"%H_%M_%S`.sql | |
| Restore: | |
| cat your_dump.sql | docker exec -i your-db-container psql -Upostgres |
| # Assumes the database container is named 'db' | |
| DOCKER_DB_NAME="$(docker-compose ps -q db)" | |
| DB_HOSTNAME=db | |
| DB_USER=postgres | |
| LOCAL_DUMP_PATH="path/to/local.dump" | |
| docker-compose up -d db | |
| docker exec -i "${DOCKER_DB_NAME}" pg_restore -C --clean --no-acl --no-owner -U "${DB_USER}" -d "${DB_HOSTNAME}" < "${LOCAL_DUMP_PATH}" | |
| docker-compose stop db |