Skip to content

Instantly share code, notes, and snippets.

View cristianbica's full-sized avatar

Cristian Bica cristianbica

View GitHub Profile
@cristianbica
cristianbica / setup_swap.rb
Last active August 29, 2015 13:58
Creates swap file on linux
# Usage:
# curl -s https://gist.githubusercontent.com/cristianbica/10347658/raw/setup_swap.rb | sudo ruby - multiplier [remove_current_swap]
# multiplier - when creating the swap will multiply the current RAM with the multiplier
# remove_current_swap - true to remove current swap in /swapfile (default false)
# Ex: curl -s https://gist.githubusercontent.com/cristianbica/10347658/raw/setup_swap.rb | sudo ruby - 2
# Ex: curl -s https://gist.githubusercontent.com/cristianbica/10347658/raw/setup_swap.rb | sudo ruby - 2 true
if ARGV[1] and ARGV[1]=="true"
puts "Removing swap from swapfile as requested ..."