Friday, April 13, 2012

Speed up ubuntu



sudo sublime-text /etc/fstab
UUID=3aff8e7d-245a-464e-8eba-3300c78887e5 / ext4 defaults,noatime,discard 0 1
UUID=1AAE-3E55  /boot/efi       vfat    umask=0077      0       1
UUID=bfd812ac-938f-488f-a01d-28a47b16a793 none            swap    sw              0       0

tmpfs   /var/cache                      tmpfs defaults,auto,noatime,nodiratime,nodev,nosuid,async 0 0
tmpfs   /var/lock                       tmpfs defaults,auto,noatime,nodiratime,nodev,nosuid,async 0 0
tmpfs   /var/log                        tmpfs defaults,auto,noatime,nodiratime,nodev,nosuid,async 0 0
tmpfs   /var/tmp                        tmpfs defaults,auto,noatime,nodiratime,nodev,nosuid,async 0 0
tmpfs   /var/mail                       tmpfs defaults,auto,noatime,nodiratime,nodev,nosuid,async 0 0
tmpfs   /run                            tmpfs defaults,auto,noatime,nodiratime,nodev,nosuid,async 0 0
tmpfs   /var/spool                      tmpfs defaults,auto,noatime,nodiratime,nodev,nosuid,async 0 0
tmpfs   /tmp                            tmpfs defaults,auto,noatime,nodiratime,nodev,nosuid,async 0 0
tmpfs   /home/pedro/.cache              tmpfs defaults,auto,noatime,nodiratime,nodev,nosuid,async 0 0
tmpfs   /var/lib/docker/tmpfs           tmpfs defaults,auto,noatime,nodiratime,nodev,nosuid,async 0 0
tmpfs   /var/lib/systemd/timers         tmpfs defaults,auto,noatime,nodiratime,nodev,nosuid,async 0 0




sudo sublime-text/etc/sysctl.conf

vm.swappiness=1
vm.vfs_cache_pressure=50
vm.dirty_background_ratio=10
vm.dirty_ratio=40
net.core.default_qdisc=fq
net.ipv4.tcp_congestion_control=bbr
net.core.rmem_max=16777216
net.core.wmem_max=16777216
net.ipv4.tcp_rmem=4096 87380 16777216
net.ipv4.tcp_wmem=4096 65536 16777216
After modifying the file should run
sudo sysctl -p --system


Firefox


Type about:config in firefox address bar and click I'll be careful,I promise!.Right click on blank area and create a new string value called ,set its value to






  • Type about:config into the address bar
  •  layers.acceleration.force-enabled -> true
  •  gfx.webrender.all -> all
  • Type browser.cache into the Filter field
  • Set browser.cache.memory.enable to true (double click it)



  • browser.sessionhistory.max_entries 50 -> 5
  • gfx.color_management.mode -> 1
  • gfx.color_management.rendering_intent -> -1 
  • browser.display.auto_quality_min_font_size -> 6 
  • browser.cache.disk.metadata_memory_limit -> 1024
  • browser.cache.disk.preload_chunk_count ->8
  • network.dnsCacheExpiration-> 86400

  • Get rid of application with high I/O usage
    To move the cache in Firefox, in the browser type ‘about:config’,
    right-click anywhere and select
    New –> String,
    browser.cache.disk.parent_directory
    /tmp/firefox
    for a super-fast memory cache

    Close all Firefox tabs and windows, and then restart the browser



    compact firefox DB's:



    for f in ~/.mozilla/firefox/*/*.sqlite; do sqlite3 $f 'VACUUM;'; done
    In firefox:
    extensions.pocket.enabled;false

    CROME


    For chrome edit the icon lanch command:
    default command: /opt/google/chrome/google-chrome %U

    /usr/bin/google-chrome-stable %U --disk-cache-dir='/tmp/chrome/' --disk-cache-size=2147483647



    pedro@pedro:~$ sudo dd if=/dev/zero of=/tmp/t.img bs=4G count=1 oflag=dsync
    0+1 records in
    0+1 records out
    2147479552 bytes (2.1 GB, 2.0 GiB) copied, 5.72344 s, 375 MB/s
    pedro@pedro:~$
    
    #/after tmp as tmpfs
    pedro@pedro:~$ sudo dd if=/dev/zero of=/tmp/t.img bs=4G count=1 oflag=dsync
    [sudo] password for pedro: 
    0+1 records in
    0+1 records out
    2147479552 bytes (2.1 GB, 2.0 GiB) copied, 1.02069 s, 2.1 GB/s
    pedro@pedro:~$ 
    
    
    

    Monday, March 12, 2012

    Clock settings in gnome like windows


    To see all the options: man date | less +/"FORMAT controls"

    mine are like windows 7: %H:%M%n%d/%m/%Y

    Sunday, March 04, 2012

    Using PHP5-FPM With Apache2 On Ubuntu 11.10

    http://www.howtoforge.com/using-php5-fpm-with-apache2-on-ubuntu-11.10



    Could not reliably determine the server’s fully qualified domain name

    sudo gedit /etc/apache2/httpd.conf

    ServerName localhost
    sudo /etc/init.d/apache2 restart

    Thursday, March 01, 2012

    Apache

    How to redirect your website base on country ip request, Apache, geoip, rewrite

    Install the mod-geoip

    sudo apt-get install libapache2-mod-geoip

    Enable the mods:

    sudo a2enmod rewrite
    sudo a2enmod geoip
    

    In your file ".htaccess" add these lines:

    # if country is PT
    RewriteEngine on
    RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^PT$
    RewriteRule ^(.*)$ http://www.site.pt
    
    # else
    RewriteEngine on
    RewriteRule ^(.*)$ http://www.site/en/
    

    You have to configure the virtual host to read the .htaccess file.
    <directory /var/www/site/>
     Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Order allow,deny
            allow from all
    </directory>
    
    

    In your file "httpd.conf" add these lines:

    
    
    GeoIPEnable On
    GeoIPDBFile /usr/local/share/geoip/geoip.dat
    
    
    
    
    Download the file from http://www.maxmind.com/app/geolitecountry and put it in /usr/local/share/geoip/geoip.dat

    There are a lot of versions. This one is free for countries :)




    Using mod_spdy With Apache2 On Ubuntu 12.04
    from: http://www.howtoforge.com/using-mod_spdy-with-apache2-on-ubuntu-12.04

    SPDY runs over HTTPS, so we need an HTTPS-enabled web site to test SPDY. Please note that SPDY will fall back to HTTPS if the user's browser does not support SPDY or if things go wrong, so installing mod_spdy doesn't hurt your existing setup.

    a2enmod ssl
    a2ensite default-ssl
    /etc/init.d/apache2 restart

    cd /tmp
    wget https://dl-ssl.google.com/dl/linux/direct/mod-spdy-beta_current_amd64.deb
    dpkg -i mod-spdy-*.deb
    apt-get -f install
    /etc/init.d/apache2 restart
    chrome://net-internals/#spdy

    systemd-timesyncd

    sudo apt update && sudo apt install systemd-timesyncd && sudo systemctl enable --now systemd-timesyncd