Halaman

Rabu, 02 Juli 2014

Creating swapfile

source: https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-12-04
  1. listing enabled swaps
    sudo swapon -s
    
  2. check available space
     df
    
  3. create swap file (the following will create 1GB swap, modify count if needed)
    sudo dd if=/dev/zero of=/swapfile bs=1024 count=1024k
    
  4. prepare the swap file by creating a linux swap area
    sudo mkswap /swapfile
    
  5. activate the swap file
    sudo swapon /swapfile
    
  6. ensure that the swap is permanent by adding it to the fstab file
    sudo nano /etc/fstab
    
    paste:
    /swapfile       none    swap    sw      0       0 
    
  7. set swappiness in the file to 10 so swap act as an emergency buffer
    echo 10 | sudo tee /proc/sys/vm/swappiness
    echo vm.swappiness = 10 | sudo tee -a /etc/sysctl.conf
    
  8. prevent the file from being world-readable
    sudo chown root:root /swapfile 
    sudo chmod 0600 /swapfile
    

Jumat, 23 Mei 2014

Fixing wireless connection problem in lubuntu

boot into recovery root command line, type mount -o remount,rw / to allow write access, install wicd apt-get install wicd and reboot

Jumat, 11 April 2014

Rails (Rack::Utils) HTTP Status Codes and Symbols

ruby -e 'require "rack/utils"; puts Rack::Utils::SYMBOL_TO_STATUS_CODE.map{|s,c| "|" + c.to_s.center(5) + "|" + s.inspect.center(60) + "|" + Rack::Utils::HTTP_STATUS_CODES[c].to_s.center(60) + "|"}.join("\n")'
| 100 |                         :continue                          |                          Continue                          |
| 101 |                    :switching_protocols                    |                    Switching Protocols                     |
| 102 |                        :processing                         |                         Processing                         |
| 200 |                            :ok                             |                             OK                             |
| 201 |                          :created                          |                          Created                           |
| 202 |                         :accepted                          |                          Accepted                          |
| 203 |               :non_authoritative_information               |               Non-Authoritative Information                |
| 204 |                        :no_content                         |                         No Content                         |
| 205 |                       :reset_content                       |                       Reset Content                        |
| 206 |                      :partial_content                      |                      Partial Content                       |
| 207 |                       :multi_status                        |                        Multi-Status                        |
| 208 |                     :already_reported                      |                      Already Reported                      |
| 226 |                          :im_used                          |                          IM Used                           |
| 300 |                     :multiple_choices                      |                      Multiple Choices                      |
| 301 |                     :moved_permanently                     |                     Moved Permanently                      |
| 302 |                           :found                           |                           Found                            |
| 303 |                         :see_other                         |                         See Other                          |
| 304 |                       :not_modified                        |                        Not Modified                        |
| 305 |                         :use_proxy                         |                         Use Proxy                          |
| 306 |                         :reserved                          |                          Reserved                          |
| 307 |                    :temporary_redirect                     |                     Temporary Redirect                     |
| 308 |                    :permanent_redirect                     |                     Permanent Redirect                     |
| 400 |                        :bad_request                        |                        Bad Request                         |
| 401 |                       :unauthorized                        |                        Unauthorized                        |
| 402 |                     :payment_required                      |                      Payment Required                      |
| 403 |                         :forbidden                         |                         Forbidden                          |
| 404 |                         :not_found                         |                         Not Found                          |
| 405 |                    :method_not_allowed                     |                     Method Not Allowed                     |
| 406 |                      :not_acceptable                       |                       Not Acceptable                       |
| 407 |               :proxy_authentication_required               |               Proxy Authentication Required                |
| 408 |                      :request_timeout                      |                      Request Timeout                       |
| 409 |                         :conflict                          |                          Conflict                          |
| 410 |                           :gone                            |                            Gone                            |
| 411 |                      :length_required                      |                      Length Required                       |
| 412 |                    :precondition_failed                    |                    Precondition Failed                     |
| 413 |                 :request_entity_too_large                  |                  Request Entity Too Large                  |
| 414 |                   :request_uri_too_long                    |                    Request-URI Too Long                    |
| 415 |                  :unsupported_media_type                   |                   Unsupported Media Type                   |
| 416 |              :requested_range_not_satisfiable              |              Requested Range Not Satisfiable               |
| 417 |                    :expectation_failed                     |                     Expectation Failed                     |
| 422 |                   :unprocessable_entity                    |                    Unprocessable Entity                    |
| 423 |                          :locked                           |                           Locked                           |
| 424 |                     :failed_dependency                     |                     Failed Dependency                      |
| 425 | :reserved_for_webdav_advanced_collections_expired_proposal | Reserved for WebDAV advanced collections expired proposal  |
| 426 |                     :upgrade_required                      |                      Upgrade Required                      |
| 509 |                        :unassigned                         |                         Unassigned                         |
| 428 |                   :precondition_required                   |                   Precondition Required                    |
| 429 |                     :too_many_requests                     |                     Too Many Requests                      |
| 431 |              :request_header_fields_too_large              |              Request Header Fields Too Large               |
| 500 |                   :internal_server_error                   |                   Internal Server Error                    |
| 501 |                      :not_implemented                      |                      Not Implemented                       |
| 502 |                        :bad_gateway                        |                        Bad Gateway                         |
| 503 |                    :service_unavailable                    |                    Service Unavailable                     |
| 504 |                      :gateway_timeout                      |                      Gateway Timeout                       |
| 505 |                :http_version_not_supported                 |                 HTTP Version Not Supported                 |
| 506 |         :"variant_also_negotiates_(experimental)"          |           Variant Also Negotiates (Experimental)           |
| 507 |                   :insufficient_storage                    |                    Insufficient Storage                    |
| 508 |                       :loop_detected                       |                       Loop Detected                        |
| 510 |                       :not_extended                        |                        Not Extended                        |
| 511 |              :network_authentication_required              |              Network Authentication Required               |

Rabu, 02 April 2014

uninstall all gems linux

curl -Ls https://gist.github.com/nixpulvis/5042764/raw/7daa611e707f1884eb701551464bfd1dc9e7a953/gem-reset | ruby

Rabu, 12 Februari 2014