Apple Issues

Here I am going to list some issues I am having with Apple products, my interactions with Apple Support and Apple Feedback.

There are some general things I don’t like about the way Apple deals with support and feedback.

After contacting support you get an email which sometimes contains a link to your ticket and sometimes does not. So you need to make a note of the link somewhere to be able to access it. Here’s the link - https://getsupport.apple.com/GetCaseDetails.do?caseid=<case-id>&locale=en_CA. The link does not contain any useful information, it only has your original message, creation date and a form to send an email. It would benefit from some history, a person assigned to it and ticket status.

If you miss a call from Apple support you will receive an email that you can call back but when you do there is no way to talk to a person who called you or find out who it was and why they called.

If you send feedback to Apple you never receive anything back and it feels as if it is a black hole.

Issues

Cross-device auto downloads work intermittently [18.03.18]

They called me back on 25.03.18. First, they verified that there was a problem by connecting to my devices, first we signed out of iCloud from both devices and signed in again - that was done to sync something I have been told. Then I talked with another person and they tested it themselves. It did work intermittently for them as well but they still suggested that I reset my device. They were not sure if it was supposed to work or not but we concluded that it was. They said they will give the logs to the engineers. Then I received an email with contact information of a person I was talking with so that I could contact them if something goes wrong.

Rating system [17.03.18] - [06.04.18]

When you add a rating you can instantly see your rating but if you close App Store and reopen it, it is no longer there. Apparently this is by design. The ratings get or might get wiped out after an app update and text reviews are not sorted at all. It also takes 48 hours - 1 week for a review to get posted. So effectively the rating system is useless. The recommendation is to contact the developer yourself and provide rating this way. Which is frankly ridiculous. They acknowledge that there is something wrong with the rating system. They said that some sort of review sorting is available in the latest beta.

I found out all that only after I had two conversations with Support. I talked to Support on 25.03.18 because they called me regarding a different issue. They explained me that I have to wait a certain amount of time before my rating is posted. Then they called me on 28.03.18 but I missed the call. I could not contact a person who called me but I still had two conversations with Support and they gave me more information which is described above. I told them that they can close the ticket because there is no way I can see my rating in the current state of the rating system.

I received an email from Apple concerning my issue on 30.03.18 which was surprising because they should have closed my ticket due to the fact that they said that viewing my ratings is impossible. The asked me to send a screen recording of my problem. On 1.4.18 I have received an email that they are looking into the issue. On 4.4.18 I received another email saying that they are looking into the issue. On 6.04.18 I received an email asking me to check if my ratings appear on “My ratings and reviews” page. I did not even know this page existed. I found it in iTunes and I found some of my latest ratings, I added more and they appeared instantly. If I changed a rating, it changed on the page as well. So I consider this issue closed.

Feature requests

Feedback system [25.03.18]

The feedback system is a black hole. You don’t see any status.

*.ics attachments can’t be opened in calendar from other apps. [30.03.18]

I can’t export an appointment to calendar from the gmail app because *.ics attachments can’t be opened in calendar.

Bug reports

Siri - wrong timezone for a city in Russia [02.18]

27.03.2016 the timezone was changed in Astrakhan, but it never got changed in Siri. I talked with Support regarding this issue and they opened a ticket for the engineering team. 28.03.18 I received an email saying that it is going to be fixed in the next update. I updated my iOS to 11.3 but Siri still says the wrong time.

Emails from Apple end up in the junk folder [30.03.18]

When I am using the mail app, some emails from Apple end up in junk folder.

Efficiency

Redundant questions [25.3.18]

When you use Support / Feedback system, it asks you to re-enter your information every time even though you are signed-in.

Rating review takes too long [30.03.18]

Rating review takes 48 hours - 1 week.


Google Chrome Extensions

Development

Google Drive

Miscellaneous


How To Watch Movies And TV Shows On PC

VPN

It is better to use VPN to stream videos. I would recommend NordVPN. It costs about 3.5 C$/month. It could increase the speed and it is also good for security and privacy. It will also allow you to watch Netflix & Amazon Prime videos which are not available in your country.

Netflix & Amazon Prime

You can find a list of Movies and TV-shows available on Netflix & Amazon Prime on JustWatch.

Netflix

Website - http://netflix.com.
Price - 11 C$/month (FullHD), 14 C$/month (4K).

Netflix is the only streaming service which allows you to watch 4K videos on a PC. It only works with Microsoft Edge browser and Netflix recommends you to have at least 25Mbit/s internet connection. You should also use the Display Port or an HDMI port and cable which supports 4K. See details on Netflix on the page “Can I stream Netflix in Ultra HD?”.

Amazon Prime

Websites:

Price - about 6.6 C$/month. It includes other benefits as well.

Kodi

Downloads

First, download Kodi.

Then you can download some of available add-on repositories:

Installation

Then you can install them by running Kodi and clicking the gear -> Settings -> Add-ons -> Enable “Unknown sources” -> Back -> Add-ons -> Install from zip file -> Choose zip file location.
After that, Install from repository -> Choose repository and install the video add-ons you like.
Then you can open the add-ons by hovering over Add-ons.

Resolve an audio issue

There is a problem with muted sound after pausing and this is a workaround to resolve this issue.

You should also install an add-on “Services - Unpause Jumpack”. To install it, search for it’s name.
Then configure it so that “Jump back onpause” section has the following values:

Cache settings

You should also create a file %APPDATA%\kodi\userdata\advancedsettings.xml with the following content:

<advancedsettings>
    <cache>
        <buffermode>2</buffermode>
        <memorysize>529530880</memorysize>
        <readfactor>5</readfactor>
    </cache>
</advancedsettings>

See details on the page “How to modify the cache” on Kodi wiki.

Logs

If something ever goes wrong and you see an error, you can find the log here: %APPDATA%\Roaming\Kodi\kodi.log.

Real Debrid

To be able to access more content you can subcribe to “Real Debrid”. It costs about 4.25 C$/month.
You have to configure it after. To configure it, search for one of the video add-ons which uses it, for example, Nemesis. Select Dependenies -> ResolveURL -> Configure -> Universal Resolvers -> Real-Debrid -> (Re)Authorize My Account -> Follow instructions on the screen.

4K

Nemesis -> Movie Zone -> 4K Movies Skynet -> Watch The Latest Movies And Shows At The Flix -> Watch At The Flix -> 4K UHD Movies
Skynet -> Maverick TV -> Maverick 4K UHD Movies
Skynet -> Maverick TV -> Real Debrid 4k UHD and FHD
Skynet -> Supremacy -> 4K Movies


Windows Tips

Windows Configuration

Settings

System

Display -> Scale and layout -> Change the size of text, apps, and other items -> 200%.
Power & Sleep -> Screen -> 15 minutes Power & Sleep -> Sleep -> Never Notification & actions -> Notifications -> Get notifications from apps and other senders -> Off Storage -> Storage Sense -> On

Personalization

Background -> Choose your picture

Accounts

Your info -> Create your picture -> Browser for one -> Choose your avatar.

Misc

Color management -> Advanced -> Display calibration -> Calibrate display.

Right click on the taskbar -> Cortana -> Hidden.
Right click on the taskbar -> Show People Button -> uncheck.

Software Configuration

Free Download Manager

Open hamburger menu -> Settings.
Browser Integration -> Enable integration with your browser and install the extension.
Browser Integration -> Automatically catch downloads from browsers -> Deselect “Use browser if you cancel download via FDM”.
Traffic Limits -> Set limits.

NordVPN

Countries -> Select a country you’d like to save as a favorite -> Hamburger menu -> Heart.

Settings:
Enable “Auto connect”, “Start NordVPN on startup”, “Start minimized”, “App Kill Switch” and select applications you want to kill if a VPN connection drops. The apps have to be running while setting this up. Choose System of measurement.

Google Chrome

chrome://settings/ -> On startup -> Continue where you left off

Usage

Remember to run GeForce Experience to update drivers from time to time.
Open Add or remove programs to uninstall programs.
Manage processes: Task Manager -> Processes.
Monitor network activity: Task Manager -> Performance -> Select Ethernet.

Games

Steam

Steam -> Settings -> Downloads -> Content Libraries -> Steam library folders -> Add library folder Steam -> Settings -> Account -> Beta participation -> Change -> Steam Beta Update Steam -> Settings -> Downloads -> Download Restrictions -> Limit bandwidth to Steam -> Settings -> Downloads -> Download Restrictions -> Allow downloads during gameplay

Uplay

Settings -> Downloads -> Default game installation location -> Change Settings -> Downloads -> Bandwidth usage limit

GOG Galaxy

Settings -> Downloads -> Installing games -> Game installation folder Settings -> Downloads -> Installing games -> Create shortcut on desktop -> check Settings -> Downloads -> Bandwidth -> While playing -> Pause downloads when playing -> uncheck Settings -> Downloads -> Bandwidth -> Bandwidth limit

VMWare Player

Disable top bar


iOS Tips

Initial configuration

Settings

Accounts & Passwords -> iCloud -> enable Mail, Contacts, Calendars and Notes
Contacts -> Sort Order and Display Order -> First, Last
Maps -> Preferred transportation type -> Walking
Messages -> enable iMessage and Send as SMS Wallet & Apple Pay -> Add Credit or Debit Card Camera -> Record Video -> set quality Display & Brightness -> Raise to Wake -> disable

Clock

World Clock -> Add Moscow, Seattle, Montreal, Tbilisi Bedtime -> Enable for weekdays

Hotkeys

Hold Home - activate Siri Double tap on Home - see running apps Home + Power - take screenshot Hold Power - turn off

Before resetting

Remove authenticator from Steam Mobile.


Windows Applications

Communication

Editors

Languages

Games

Steam

Cloud Storage

Media

Music

Browsers

Administration

Utils

Downloaders

TV / Movies / Streams

Graphics


iOS Apps

iPad + iPhone

Health & Fitness

Games

Internet

Email

Messengers

Cloud Storage

Misc

Calculators

Books

Social

Entertainment

Shopping

TV

Productivity

Music

Translation

Utilities

Reference

Food / Drinks

Travel

Canada

Lifestyle

Shopping

Food / Drinks

Movies

Banking

Health

Russia

Social

Maps

Transport

News

Devices

Philips Hue

Lifestyle

iPhone

Health & Fitness

Lifestyle

Calculators

Messengers

Social

TV

Images

Utilities

Photos

Devices

Reading

Canada

Montreal

Food & Drink

Banking

Mobile

Russia

Transport

iPad

Shopping

Messengers


MacOS Tips

Installation

Do not format your drive as a case sensitive partition. You won’t be able to run applications like Steam or Photoshop.

MacOS Configuration

Contacts -> File -> New Smart Group -> Card / is not member of / any group

Remove duplicates in “open with”

/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user

View sleep/wake log

pmset -g log|grep -e " Sleep  " -e " Wake  "

Reindex Spotlight index

sudo mdutil -E /
sudo mdutil -i on /

How to wipe your Mac & reset to factory settings


Web Development

Javascript

jQuery

Add jQuery through console

var jq = document.createElement('script');
jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js";
document.getElementsByTagName('head')[0].appendChild(jq);
// ... give time for script to load, then type.
jQuery.noConflict();

Extend jQuery

$.fn.visible = function() {
    return this.css('visibility', 'visible');
};

$.fn.invisible = function() {
    return this.css('visibility', 'hidden');
};

Python

A good way to start any python2 script

# -*- coding: utf-8 -*-
from __future__ import unicode_literals

Helpful command if anything behaves strangely

find . -name "*.pyc" -exec rm -rf {} \;

Kill Debugger

import os; os.system('kill -9 %d' % os.getpid())

Django

Management commands

Data migration example

from django.db import migrations

def action(apps, schema_editor):
    [Model] = apps.get_model('[app]', '[Model]')

class Migration(migrations.Migration):
    dependencies = [
        ('[app]', '0001_initial'),
    ]

    operations = [
        migrations.RunPython(action),
    ]

Data migration example to load fixtures

from django.db import migrations
from django.core.management import call_command


def load_fixture(apps, schema_editor):
    # File name.json in fixtures dir
    call_command('loaddata', '[name]', app_label='[app]')


class Migration(migrations.Migration):

    dependencies = [
        ('[app]', '0001_initial'),
    ]

    operations = [
        migrations.RunPython(load_fixture)
    ]

HOWTO setup internalization

Add to settings:

from django.utils.translation import ugettext_lazy as _
import os.path as op

LANGUAGES = (
    ('en', _('English')),
    ('ru', _('Russian')),
)

LOCALE_PATHS = (
    op.join(local_settings.PROJECT_ROOT, 'project', 'src', 'locale'),
)

Add to templates:

{% load i18n %}

{% trans 'text' %}
{% blocktrans %}Back to '{{ race }}' homepage{% endblocktrans %}

To create/update necessary .po files:

python manage.py makemessages

Install django-rosetta

You can then access your translations here - /rosetta

JS

To create/update necessary .po files:

python manage.py makemessages -d djangojs

urls.py

from django.views.i18n import JavaScriptCatalog

    url(r'^jsi18n/$',
        JavaScriptCatalog.as_view(packages=('moviesapp', ), domain='djangojs'),
        name='javascript-catalog'),

urlpatterns += [
    url(r'^jsi18n/$',
        JavaScriptCatalog.as_view(packages=('[app]', ), domain='djangojs'),
        name='javascript-catalog'),
]

Add to templates before any js code:

<script src="{% url 'javascript-catalog' %}"></script>

If you also need access to the language in js add:

  {% get_current_language as LANGUAGE_CODE %}
  <script>
    var language = '{{ LANGUAGE_CODE }}';
  </script>

To use:

gettext('this is to be translated');

Additional info in django docs

Py.test

pytest.ini
[pytest]
DJANGO_SETTINGS_MODULE = settings
python_paths = apps
python_files = tests.py
addopts = --nomigrations --reuse-db
Install
pip install pytest-django
Usage

Documentation

# With db recreate
py.test --create-db

# To ignore directory
py.test --ignore=apps/app_name

# To run only test_function from apps/app_name directory
py.test apps/app_name -k test_function --create-db

Services for your projects.


nginx

PHP setup

apt-get install php5-fpm php5-mysql
nano /etc/php5/fpm/php.ini

Change cgi.fix_pathinfo=0

Restart php

service php5-fpm restart

Create configuration file in /etc/nginx/sites-enabled/

server {
    server_name [domain];
    charset     utf-8;
    root [path_to_site];
    index index.php;

    location ~ \.php$ {
           fastcgi_split_path_info ^(.+\.php)(/.+)$;
           try_files $uri =404;
           fastcgi_pass unix:/var/run/php5-fpm.sock;
           fastcgi_index index.php;
           include fastcgi_params;
    }
}
service nginx restart

Installation Of Services On Ubuntu

Install a service

Create file with contents:

/etc/systemd/system/[name].service

[Unit]
Description=[Service Name]
After=syslog.target

[Service]
ExecStart=[command]
Restart=always
RestartSec=5s
KillSignal=SIGQUIT

[Install]
WantedBy=multi-user.target

Run

chmod 644 /etc/systemd/system/[name].service
systemctl daemon-reload

Samba

sudo apt-get install samba
sudo smbpasswd -a [user] # Set a password for your user in Samba
sudo nano /etc/samba/smb.conf

Add this to the end of the file:

[[name]]
path = [path]
available = yes
valid users = [user]
read only = no
browseable = yes
public = yes
writable = yes
sudo restart smbd

stunnel4

Stunnel allows old devices which don’t support smtp connections through ssl to support them.

sudo apt-get install stunnel4

sudo sed -i 's/ENABLED=0/ENABLED=1/g' /etc/default/stunnel4

openssl req -new -out mail.pem -keyout mail.pem -nodes -x509 -days 365
# (Common name - domain name)

sudo mv ~/mail.pem /etc/ssl/certs/mail.pem

sudo cp /usr/share/doc/stunnel4/examples/stunnel.conf-sample /etc/stunnel/stunnel.conf
sudo nano /etc/stunnel/stunnel.conf

Change:

cert = /etc/ssl/certs/mail.pem
sslVersion = all

Add: (example)

[yandex-smtp]
client = yes
accept = 0.0.0.0:25
connect = smtp.yandex.ru:465

Grive

Install Grive and sync

sudo add-apt-repository ppa:nilarimogard/webupd8
sudo apt-get update
sudo apt-get install grive -y
mkdir /mnt/GoogleDrive
cd /mnt/GoogleDrive
grive -a

Sublime Text

Sublime Text

Settings

Project settings example

{
    "folders":
    [
        {
            "path": "[project_path]",
            "folder_exclude_patterns": ["[project_exclude_path]"],
            "file_exclude_patterns": ["[*.txt]"],
        }
    ]
}

Tips

The way to edit current projects (in the switch project list): Edit workspaces: ~/Library/Application Support/Sublime Text 3/Local/Session.sublime_session.

Hotkeys

Ubuntu

Enable middle mouse support.

nano ~/.config/sublime-text-3/Packages/User/Default\ \(Linux\).sublime-mousemap
[
    // Mouse 3 column select
    {
        "button": "button3",
        "press_command": "drag_select",
        "press_args": {"by": "columns"}
    },
    {
        "button": "button3", "modifiers": ["ctrl"],
        "press_command": "drag_select",
        "press_args": {"by": "columns", "additive": true}
    },
    {
        "button": "button3", "modifiers": ["alt"],
        "press_command": "drag_select",
        "press_args": {"by": "columns", "subtractive": true}
    }
]

MacOS Applications

Homebrew

Movies / Video

Languages

Administration

Utils

Editors

Communication

Music

Cloud Storage

Browsers

Libraries

AppStore

Games

Downloaders

TV / Movies


Documentation And Styleguides

Styleguides

Python

Frontend

Javascript

HTML/CSS

URL

SASS

Documentation

Javascript

Python

SASS


Web Development Tools

Misc

Web

MacOS, Ubuntu and Windows Apps

DB

Editors

Virtual Machines

MacOS and Windows Apps

Source Control Management

MacOS Apps

Source Control Management

DB

Ubuntu Apps

Windows Apps

Virtual Machines


Reference Materials For Web Development And Programming

JavaScript

Important

ES6

Misc

Coffeescript

GitHub

Git

Web Development

Coding

Python

Django

CSS

Regular Expressions

Coding Games/Challenges

Misc


Python Modules Installation

Python

Create a requirements.txt file with the following format:

Django==2.0.2
mysql-python>=1.0
-e git+https://github.com/desecho/django-tqdm@1.0.3.git#egg=django-tqdm
# comment

Install using command: pip install -r requirements.txt --exists-action s


Git

Git
Git Documentation

Basics

Commands

git init [project-name]
git clone [url] <dir>
git remot­e add origi­n git@g­ithub.com:[user]/[project].git

git pull
git push
git push -f  # Force push

git branch  # List all local branches
git branch -r  # List all remote branches
git branch -a  # List local and remote branches
git branch -D [branch]  # Delete a branch
git branch -m [branch]  # Rename current branch to [branch]
git branch [branch]  # Create a branch

git checkout [branch]
git checkout -b [branch]  # Create a new branch and checkout the new branch.
git checkout -b [new-branch] [existing-branch]

git status
git log
git log --oneline
git log --follow [file]
git log -n [limit]
git log --grep="[pattern]"
git log --author="[pattern]"
git log [commit1]..[commit2]

git show [commit]  # List commit changes
git diff
git diff --staged
git diff [old_commit_hash] [new_commit_hash]
git diff [old_branch] [new_branch]
git diff --word-diff [commit1] [commit2] --unified=0  # Show difference in words and
													  # hide context

git add .  # Stage all files
git add -p  # Interactive staging
git add -N [file]  # Just add a file to tracking

git checkout -- [file]  # Removes all changes to [file]
git checkout -f  # Remove all changes to the last commit
git reset --hard  # Remove all changes to the last commit

git reset
git reset [file]
git reset [commit]
git reset [commit] --hard  # Remove all changes to [commit]

git rebase [branch]
git rebase --continue
git rebase --abort
git rebase -i # Interactive rebase.
git rebase -i [branch]

git clean -n  # List files which would be deleted by the command below
git clean -f  # Delete untracked files

git revert [commit]

git commit -m'[commit message]'
git commit -a  # Commit all changed files accept for untracked files. Also delete deleted
			   # files.
git commit --amend  # Amend a commit (with staged files)
git commit --amend --author="Anton Samarchyan <desecho@gmail.com>"  # Change the author of previous commit
git commit --amend --no-edit  # Amend a commit without changing the commit message

git stash
git stash pop <stash>
git stash apply <stash>
git stash list
git stash drop <stash>
git stash show [stash]  # Show stash changes
git stash clear  # Remove all stashes

git rm [file]
git mv [file-original] [file-renamed]

git blame [file]
git blame -L [line_start],[line_end] [file]
git merge-base [branch1] [branch2]

git ls-files --other --ignored --exclude-standard  # List all ignored files
git update-index --assume-unchanged [file]
git update-index --no-assume-unchanged [file]
git ls-files -v | grep '^[[:lower:]]'  # List files flagged as "unchanged"

Merging

git merge [branch]
git merge --abort
git reset --merge ORIG_HEAD  # Cancel previous merge

# On conflicts:
git show :1:[file] > [file1]  # Common ancestor
git show :2:[file] > [file2]  # Version from current branch
git show :3:[file] > [file3]  # Version from test branch

Submodules

Initiate submodules and load them

git submodule init
git submodule update

How to add a submodule

git submodule add http://github.com/[username]/[repo].git my/path

How to remove a submodule

  1. Delete the relevant section from the .gitmodules file.
  2. git add .gitmodules
  3. Delete the relevant section from .git/config
  4. git rm --cached [path_to_submodule] # (no trailing slash)
  5. rm -rf .git/modules/[path_to_submodule]
  6. git commit -m "Removed submodule [name]"
  7. rm -rf [path_to_submodule]

Update branch with upstream

git remote add upstream https://github.com/[user]/[project].git
git fetch upstream
git checkout master
git rebase upstream/master

Tips

Ignore files without adding it to .gitignore.

Edit file .git/info/exclude

Ignore files only in diff command

Create a repository specific diff driver:

for Linux:
$true = /bin/true

for Mac OS:
$true = /usr/bin/true
git config diff.nodiff.command $true

Then, assign the new diff driver to those files you want ignored in your .git/info/attributes file.
[file] diff=nodiff

Remove data from repository’s history

Removing sensitive data from a repository


PostgreSQL

Main commands

Copy DB

CREATE DATABASE [db2] WITH TEMPLATE [db1] OWNER [user];

Commands

Connect to DB

sudo -u postgres psql "user='[user]' password='[password]' host='[localhost]' port='[port]' dbname='[db_name]'"

Create database:

sudo -u postgres createdb -O user_owner --encoding='utf-8' --locale=en_US.utf8 my_database

Run command:

sudo -u postgres psql "user='postgres' password='password' host='localhost' port='5432' dbname=my_database" -c "CREATE EXTENSION postgis";

Import dump

sudo -u postgres psql "user='postgres' password='password' host='localhost' port='5432' dbname=my_database" -f file.sql

Create db from template

sudo -u postgres createdb -O user_owner --encoding='utf-8' --locale=en_US.utf8 -T my_database my_database2

Activate correct encoding

SET client_encoding = 'UTF8';

Open access

echo 'host all all 192.168.0.0/24 trust' >> /etc/postgresql/9.1/main/pg_hba.conf

listen_addresses='[ip]'

service postgresql restart

Ubuntu Apps

Administration

Monitoring

Misc

Crontab

Examples:

0 0 * * * /home/script.sh > /var/log/script.log 2>&1  # run every day at 00:00, also record errors
0 0 1 * * /home/script.sh > /var/log/script.log  # run at 00:00 on the first day of the month
* * * * * /home/script.sh > /var/log/script.log  # run every minute
*/10 * * * * /home/script.sh > /var/log/script.log  # run every 10 minutes
@reboot /home/script.sh  # Run on reboot

Nano

Screen

Screen manager.

How to be able to run programs for X server

sudo apt-get install xvfb
sudo Xvfb :10 -ac
export DISPLAY=:10

Fix locales

export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8

Virtualbox

Enable auto time synchronization with host

vboxmanage setextradata [vbox] "VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled" "1"

Virtualenvwrapper

Terminator

Hotkeys:


MySQL

Reset root password

sudo service mysql stop
sudo mysqld --skip-grant-tables &
mysql -u root mysql
UPDATE user SET Password=PASSWORD('[password]') WHERE User='root';
FLUSH PRIVILEGES;

Administer users

[ip] can be %, which means any, localhost, or ip-address

CREATE USER '[user]'@'[ip]' IDENTIFIED BY '[password]';
DROP USER '[user]'@'[ip]';

Open access

Instead of [db] and [table] can be *, which means any. [privilege] can be ALL, USAGE, SELECT etc.

Details

GRANT [privilege] ON `[db]`.`[table]` to '[user]'@'[ip]' IDENTIFIED BY '[password]' WITH GRANT OPTION;
FLUSH PRIVILEGES;

Create database

CREATE DATABASE `[name]` CHARACTER SET utf8 COLLATE utf8_general_ci;

Open access to external users

mysql -uroot -p[password] -e "GRANT ALL ON *.* to root@'%' IDENTIFIED BY '[password]' WITH GRANT OPTION; FLUSH PRIVILEGES;"
sed -i 's/127.0.0.1/0.0.0.0/g' /etc/mysql/my.cnf
service mysql restart

Encoding

Check encoding

For Databases:

SELECT default_character_set_name FROM information_schema.SCHEMATA WHERE schema_name = "[dbname]";

For Tables:

SELECT CCSA.character_set_name FROM information_schema.`TABLES` T,
       information_schema.`COLLATION_CHARACTER_SET_APPLICABILITY` CCSA
WHERE CCSA.collation_name = T.table_collation
  AND T.table_schema = "[dbname]"
  AND T.table_name = "[tablename]";

For Columns:

SHOW FULL COLUMNS FROM [tablename];

Change collation for a database

ALTER DATABASE [dbname] CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE [tablename] CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;

Add timezone info to the DB

mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -D mysql -u root -p
mysql -u root -p -e "flush tables;"

Ubuntu Installation

Write Ubuntu image on a flash drive

hdiutil convert -format UDRW -o ~/image ubuntu-12.10-desktop-amd64.iso
diskutil list  # find which drive is a flash drive
diskutil unmountDisk /dev/disk2  # disk2 is an example
sudo dd if=~/image.dmg of=/dev/rdisk2 bs=1m
diskutil eject /dev/disk2

Initial Ubuntu Configuration

Setup SSH Access from one computer to another without the need of entering password each time

ssh-keygen -t rsa -C "[email]" -f ~/.ssh/id_rsa -N ''
ssh-copy-id -i ~/.ssh/id_rsa.pub '-p [port] [username]@[ip]'

Run sudo commands without password request

sudo visudo Add to the end: [user] ALL=(ALL) NOPASSWD: ALL

Set up DNS server

nano /etc/resolv.conf
nameserver 8.8.8.8

Protect from attacks

How To Protect SSH with Fail2Ban on Ubuntu 14.04

Enable password authentication through SSH

nano /etc/ssh/sshd_config

Change PasswordAuthentication and ChallengeResponseAuthentication to yes.

service ssh restart


Ubuntu commands

Simple program execution: program -[option1][option2] --[special_option]

Directories

Files

Processes

Access rights

For all of the commands below: -r - recursive change.

find [path] -type d -exec chmod 755 {} \;
find [path] -type f -exec chmod 644 {} \;

File reading

Device mounting

Network

Administration

User administration

Package management

Variables

Additional

Shortcuts

HowTos


Ubuntu Network Settings

IP Configuration

  1. Clear the configuration file sudo cat /dev/null > /etc/network/interfaces
  2. Edit configuration file with appropriate settings
  3. Restart networking service
sudo service networking restart

Static IP

auto lo eth0
iface lo inet loopback
iface eth0 inet static
    address 192.168.0.2
    netmask 255.255.255.0
    network 192.168.0.0
    broadcast 192.168.0.255
    gateway 192.168.0.1
    dns-nameservers 8.8.8.8

Dynamic IP

auto lo eth0
iface lo inet loopback
iface eth0 inet dhcp

Vlan Configuration

sudo apt-get install -y vlan
auto lo eth0.10 eth0.20
iface lo inet loopback
iface eth0.10 inet static
    address 192.168.0.2
    netmask 255.255.255.0
    network 192.168.0.0
    broadcast 192.168.0.255
    gateway 192.168.0.1
    dns-nameservers 8.8.8.8
iface eth0.20 inet static
    address 192.168.1.2
    netmask 255.255.255.0
    network 192.168.1.0
    broadcast 192.168.1.255