[SOLVED] vmware-hostd high cpu usage

    This can get quite annoying at times, but it if you notice vmware-hostd taking up cpu, you can disable VMs sharing by going to Edit > Preferences > Shared VMs > Disable Sharing.

    Will fix instantly.

    Enjoy!

    Tags: , , , ,

    git – large file removed but still can’t push

    So i have a git repo where a large file got commited by mistake:

    git push origin master
    Counting objects: 2480, done.
    Delta compression using up to 4 threads.
    Compressing objects: 100% (1922/1922), done.
    Writing objects: 100% (2480/2480), 484.14 MiB | 15.10 MiB/s, done.
    Total 2480 (delta 697), reused 0 (delta 0)
    remote: error: GH001: Large files detected. You may want to try Git Large File Storage – https://git-lfs.github.com.
    remote: error: Trace: b3405c85f13ee38933ee3ba62be554e1
    remote: error: See http://git.io/iEPt8g for more information.
    remote: error: File auf2/aaaaa.mp4 is 389.00 MB; this exceeds GitHub’s file size limit of 100.00 MB

    I removed the file, commited bla bla and still in the commit history, the file would exist and i would get the same message over and over again.

    In order to fix this, i had to remove it from the history using the command below:

    git filter-branch –index-filter ‘git rm -r –cached –ignore-unmatch auf2/aaaaa.mp4’ HEAD

    Enjoy!

    Tags: , , , ,

    htaccess redirect http:// to www and vice versa

    RewriteEngine On
    RewriteBase /

    # Redirect to www
    RewriteCond %{HTTP_HOST} ^[^.]+\.[^.]+$
    RewriteCond %{HTTPS}s ^on(s)|
    RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

    #Redirect to http://
    RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
    RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

    Enjoy

    Tags: , , , , ,

    Useful vi commands

    Just in case you’re lost at some point.

    “o” = insert mode
    “A” = edit at the end
    “a” = edit where you are
    “shift r” = replace some text
    “yy” “5yy” = copy the lines
    “p” “shift p” = paste below or above the line
    “dd” “10dd” = deletes the line
    “shift h” = go top
    “shift l” or “shift g” = go bottom
    “cw” = replace only 1 word – different than “shift r”
    “/” = search forward | “n” and “shift n” – go to the next search
    “?” = search backward
    “u” = undo
    “:%s/the/katmai” – replace in all the doc
    “:1s/the/katmai” – replace on a line
    “:e filename” – loads a file
    “:r filename” – loads the contents of another file

    Tags: , , ,

    disable and stop firewall on CentOS7

    For the time being the firewall has to be off. I will replace it with csf anyway.

    [root@500748 ~]# systemctl list-unit-files |grep -i firewall
    dbus-org.fedoraproject.FirewallD1.service enabled
    firewalld.service enabled
    [root@500748 ~]# systemctl disable firewalld
    rm ‘/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service’
    rm ‘/etc/systemd/system/basic.target.wants/firewalld.service’

    [root@500748 ~]# systemctl stop firewalld
    [root@500748 ~]#

    Done!

    Tags: , , , , ,

    CentOS7 disable ipv6

    For the time being this has to stay off for clarity sake:

    Add:
    net.ipv6.conf.all.disable_ipv6 = 1
    to /etc/sysctl.conf
    
    then type: sysctl -p
    
    Done.
    Tags: , , , ,

    CentOS7 change hostname

    I started switching recently (i know i should have probably started earlier but meh, was busy) switching boxes to CentOS7. Changing the hostname is slightly different now:

    [root@500748 ~]# hostnamectl status
    Static hostname: beast1.domain.com
    Icon name: computer-desktop
    Chassis: desktop
    Machine ID: e289f5250bd548609d5989766573ab49
    Boot ID: 844dbb05561c4c599aad84d9f685d0e8
    Operating System: CentOS Linux 7 (Core)
    CPE OS Name: cpe:/o:centos:centos:7
    Kernel: Linux 3.10.0-229.el7.x86_64
    Architecture: x86_64

    So in order to change the hostname you would do:

    hostnamectl set-hostname my.new.hostname

    Done!

    Tags: , , , ,

    cPanel/WHM mass add spf and domainkeys to all accounts

    I am not really just now adding these, i merely ran some cleanups on the zones, removing obsolete ip’s and stuff like that, but i thought to share the script i used to reset the DKIM and SPF records for all accounts:

    #!/bin/bash -x
    for user in `ls -A /var/cpanel/users`;
    do
    /usr/local/cpanel/bin/dkim_keys_install $user && /usr/local/cpanel/bin/spf_installer $user;
    done

    Enjoy!

    Tags: ,

    Previous value removed by cPanel transfer auto-merge

    So i have been doing a hardware upgrade, and during the migration of the accounts, the target server named zone files got polluted with stuff like this:

    ; 86400 ;refresh ; Previous value removed by cPanel transfer auto-merge on 20150804093325 GMT
    ; 7200 ;retry ; Previous value removed by cPanel transfer auto-merge on 20150804093325 GMT
    ; 3600000 ;expire ; Previous value removed by cPanel transfer auto-merge on 20150804093325 GMT
    ; 86400 ) ; Previous value removed by cPanel transfer auto-merge on 20150804093325 GMT

    In order to clean things up, you can do something like this:

    1 –  backup your named folder : cd /var;tar czf named.tgz named

    2 – cd /var/named

    perl -i.bak -ne ‘next if (/^; .+ ; Previous value removed by cPanel transfer auto-merge on/); print;’ /var/named/*.db

    /scripts/restartsrv_named

    Voila! Things should be clean.

    Tags: , , ,

    nano / pico replace text

    Dunno why i haven’t used this earlier. There have been some instances when i had to search and replace some text in nano or pico (i can’t get accustomed to nano, so i always symlink nano to pico lol). Anyway here it goes:

    Press: Ctrl + \

    After that it’s pretty self explanatory:
    Enter your search term [press return]
    Enter your replacement term [press return]

    You can either press Y to see every instance getting replaced, or take the easy route and press A [to replace all instances].

    Enjoy your new found nano / pico skills.

    Tags: , , , , ,