Productivity tip – Session Buddy

    If you’re like me, you probably have groups of tabs opened in your browser, for instance this is how my taskbar looks like:

    So i usually split up my tabs into: work, education, reading and so on.

    The problem is that sometimes when Chrome crashes and i don’t get the “restore tabs” option, i have to redo everything aaaaalll over again and it’s quite a pain.

    Enter “Session buddy” – an extension from the Play Store. Install it and your sessions get saved quite nicely:

    Hope this boosts your productivity!

    Segmentation faulty tree

    So i just came across this problem: as i was working with a Raspberry pi, i got the following message: “Segmentation faulty tree” as i was trying to install a few packages on my raspbian jessie.

    Luckily, it was a quick fix:

    sudo rm /var/cache/apt/*.bin
    apt update && apt upgrade
    
    
    

    Google Cloud Platform – FTP

    So if you’re getting an error similar to this: “500 I won’t open a connection to 10.142.0.9 (only to…” if you’re trying to use FTP on a VM on Google Cloud, fear not, it’s an easy fix.

    You can do this 2 ways:

    1 – FTP -p remote-host

    or

    2 – FTP remote-host -> log in -> then type “passive” without quotes, and everything should be just fine.

    Enjoy!

    MySQL 5.7 – reset root password

    So there’s been a change in the way you reset the MySQL root password in MySQL 5.7 as in the “password” field got removed, so the old way of resetting the password doesn’t work anymore:

    | authentication_string | text | YES | | NULL | |

    So let’s go:

    1 – stop the mysqld:

    systemctl mysqld stop

    2 – start mysqld with skip-grant so it doesn’t ask for your password:

    mysqld –skip-grant-tables &

    3 – change the pw:

    use mysql;

    update user set authentication_string=password(‘yourNewPwHere’) where user=’root’;

    flush privileges;

    quit

    4 – stop the mysql

    5 – start the mysql with the new root pw

    systemctl start mysqld

    Enjoy!

    Dynamic robots.txt – block search engines for all robots.

    If you have multiple websites on a server or wildcard websites and you don’t want to create 1000 robots.txt files, but you want to disallow search engines access,  you can do the following elegant solution:

    Create a robots.txt with the content below:
    User-agent: *
    Disallow: /

    Then create your robots.txt file somewhere on your server.

    Add the following to your httpd.conf:

    # Exclude all robots
    <Location “/robots.txt”>
    SetHandler None

    Alias /robots.txt /path/to/robots.txt

    Restart your httpd server and you’re good to go!

    Reset wordpress file/folder permissions

    If you need a quick and easy fix for broken wordpress permissions - feel free to copy/paste the lines below. These will reset them to defaults.
    
    cd /your/wordpress/folder
    find . -type d -exec chmod 755 {} \;  # Change directory permissions rwxr-xr-x
    find . -type f -exec chmod 644 {} \;  # Change file permissions rw-r--r--

    write:errno=104 / New, (NONE), Cipher is (NONE)

    So if you’re having some issues with SSL connections, it’s higly likely you’re experiencing them from client version openssl 1.0.2. the fix is below and i can confirm it works on both openssl 1.0.1 and 1.0.2.

    openssl s_client -connect yourdomain.com:5671 -showcerts
    CONNECTED(00000003)
    write:errno=104

    no peer certificate available

    No client certificate CA names sent

    SSL handshake has read 0 bytes and written 305 bytes

    New, (NONE), Cipher is (NONE)
    Secure Renegotiation IS NOT supported
    Compression: NONE
    Expansion: NONE
    No ALPN negotiated
    SSL-Session:
    Protocol : TLSv1.2
    Cipher : 0000
    Session-ID:
    Session-ID-ctx:
    Master-Key:
    Key-Arg : None
    PSK identity: None
    PSK identity hint: None
    SRP username: None
    Start Time: 1484575655
    Timeout : 300 (sec)
    Verify return code: 0 (ok)

    openssl s_client \

    -cipher RSA \

    -connect mydomain.com:5671 \

    -servername mydomain.com \

    -cert client/cert.pem \

    -key client/key.pem \

    -CAfile testca/cacert.pem \

    -tls1_2

    Enjoy!

    vBulletin – can’t login to admincp

    So i had the weirdest issue today:

    Last night, i installed vbulletin as i want to get a forum going for our new project: Dive: Frozen in time – a puzzle-driven skydiving game in Virtual Reality, made by our brand new studio: spinningBOX VR Studios and everything was fine. Went to bed and when i try to login – i can login to the website but not to the admincp. I was pretty amazed, however one really easy fix was this:

    change your cookie prefix in core/includes/config.php to rewrite the cookie key.

    $config['Misc']['cookieprefix'] = 'bb';
    to 
    $config['Misc']['cookieprefix'] = 'bb1';
    
    Problem solved.
    Enjoy!

    npm ERR! EPROTO: protocol error, symlink ‘../rimraf/bin.js’

    So i was trying to spin up a docker app in a node.js docker container but i got the error below:

    npm ERR! Linux 4.4.24-boot2docker
    npm ERR! argv “/usr/local/bin/node” “/usr/local/bin/npm” “install”
    npm ERR! node v6.9.1
    npm ERR! npm v3.10.8
    npm ERR! path ../rimraf/bin.js
    npm ERR! code EPROTO
    npm ERR! errno -71
    npm ERR! syscall symlink

    npm ERR! EPROTO: protocol error, symlink ‘../rimraf/bin.js’ -> ‘/root/src/node_modules/.bin/rimraf’
    npm ERR!
    npm ERR! If you need help, you may report this error at:
    npm ERR! <https://github.com/npm/npm/issues>

    npm ERR! Please include the following file with any support request:
    npm ERR! /root/src/npm-debug.log

    Quite a cool fix was:

    [email protected]:~/src# npm install –no-bin-links

    Ended up working just fine. Enjoy!

    npm info lifecycle [email protected]~install: [email protected]
    npm info lifecycle [email protected]~postinstall: [email protected]
    npm info lifecycle [email protected]~prepublish: [email protected]
    [email protected] /root/src
    `– [email protected]
    `– [email protected]
    `– [email protected]
    `– [email protected]
    +– [email protected]
    +– [email protected]
    `– [email protected]
    `– [email protected]
    +– [email protected]
    `– [email protected]

    npm info ok
    [email protected]:~/src#

    Git cheat sheet

    Some of the stuff that i use more frequently and i still haven’t learned by heart yet, I will be putting them here, in this beautiful cheat sheet.

    List all tracked files:

    git ls-tree --full-tree -r --name-only HEAD

    Untrack file in git:

    echo "FILE_NAME" >> .gitignore
    git rm --cached FILE_NAME
    git add -u
    git commit -m "removing file from source control"
    git pull origin master
    git push origin master
    
    (replace master with the branch you're on)