linux

How I setup my nvim | Debian 12

I use this preconfigure nvim config: https://github.com/NeuralNine/config-files/blob/master/init.vim
1. Install neovim 

sudo apt install neovim git-core curl

2. Create nvim directory under .config and paste the neovim preconfiguration from NeuralNine to init.vim

/home/username/.config/nvim/init.vim

3. Install nvim plug in directory (https://github.com/junegunn/vim-plug) /home/username/.config/nvim:

Using Token as authentication for websocket | django == 4.0.3 | channels == 3.0.4

Using Token as authentication for websocket

Version:

        django == 4.0.3
        channels == 3.0.4
    

Important notice: must declare first before, AuthMiddlewareStack.

import os
import django

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myapp.settings')

django.setup()

from channels.auth import AuthMiddlewareStack
    

1.Add middleware.py in your django app.

How I create multiple django site for subdomain1 and subdomain2, using gunicorn + nginx + systemd | ubuntu 20.04 | DigitalOcean

Prerequisite:

1.Can run gunicorn on your env

gunicorn --bind 0.0.0.0:9001 myapp.wsgi
2.Added subdomain on droplet networking. 3.Root access. 4.Install certbot nginx
sudo apt install certbot python3-certbot-nginx
.

Create multiple django site for subdomain1 and subdomain2, using gunicorn + nginx + systemd | DigitalOcean.

1.Make sure you already installed the gunicorn on your django env

pip install gunicorn

2.Create new socket file on

sudo nano /etc/systemd/system/gunicorn_subdomain1.socket

Ubuntu 18.04lts slow boot time even using SSD

My problem was the network was running so slow to detect.

This is my pc specs:
pc specs

I reduce the time for this to process to save time at boot.
I edited networking.services

sudo nano /etc/systemd/system/network-online.target.wants/networking.service

Change

TimeoutStartSec=5min

To

TimeoutStartSec=2s

Then reboot.

How to mount your iphone with IOS 10 up using linux OS

For iOS10 it only show the "Apps" folder.
If you don't even have that, please do:

idevicepair unpair
idevicepair pair

Do the last one multiple times until successful (follow the hints on screen)
Finally reboot your computer.

Now, you will not have access to your media still. It must be a simple bug because it can be solved with:

mkdir ~/Desktop/iOSmount
ifuse ~/Desktop/iOSmount

Note that you will need root permissions to unmount this:

Linux CentOs LAMP

Install update

$ sudo yum update

Install apache

Install apache

$ sudo yum install httpd

Start apache

$ sudo systemctl start httpd.service

Set apache to start on boot

$ sudo systemctl enable httpd.service

Set firewall

$ sudo firewall-cmd --add-service=http --permanent

Install MySQL

Install MySQL

$ sudo yum install mariadb-server mariadb

Start MySQL

$ sudo systemctl start mariadb

Set MySQL to start on boot

Linux UBUNTU server setup

Run the update

$ sudo apt-get update

Install Apache

$ sudo apt-get install apache2

Install mysql

$ sudo apt-get install mysql-server

Install php

$ sudo apt-get install php libapache2-mod-php php-mcrypt php-mysql

Install php-xml

$ sudo apt-get install php-xml

Install cups

$ sudo apt-get install cups cups-bsd

Install unoconv

$ sudo apt-get install unoconv

Install ssh

$ sudo apt-get install openssh-server

Install Voice speak

Raspberry pi clone on linux

Backup Raspberry Pi SD Card

1. Insert the SD card in your PC using a USB or built-in card reader. Now open a Terminalwindow, and enter the command sudo fdisk -l. This will list all the filesystems present on your system.

2. Try to find out the device name of your SD card. I have a 16GB SD card, so it is easily identified as the device /dev/sdb which has a size of 14.9GB. This is because the actual storage on a device is always slightly lower than advertised. Note down this device name.

Raspberry pi install printer on raspbian lite

Install cups on your raspberry pi (raspbian lite)

$ sudo apt-get install cups cups-bsd

Set your hostname on cups configuration

$ sudo nano /etc/cups/cupsd.conf

To remotely control your printer using webpage (cups):

$ cupsctl --remote-admin

 

To test printing on command line

$ lp -d printer_name ~/my/file/destination/test.doc

Vagrant update php version in Debian Wheezy

edit file sources.list

$ sudo nano /etc/apt/sources.list

add

deb http://packages.dotdeb.org wheezy all
deb-src http://packages.dotdeb.org wheezy all
deb http://packages.dotdeb.org wheezy-php56-zts all
deb-src http://packages.dotdeb.org wheezy-php56-zts all

Then run

$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install php5

To reset MYSQL root password:

$ sudo dpkg-reconfigure mysql-server-5.5

Grant all privileges to a user

$ GRANT ALL PRIVILEGES ON mydb.* TO 'myuser'@'%' WITH GRANT OPTION;

Docker set up on linux mint

Install docker

$ sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
$ sh -c 'echo deb https://apt.dockerproject.org/repo ubuntu-trusty main > /etc/apt/sources.list.d/docker.list'
$ sudo apt-get update
$ sudo apt-get purge lxc-docker
$ sudo apt-get install linux-image-extra-$(uname -r)
$ sudo apt-get install docker-engine
$ sudo service docker start
$ sudo usermod -aG docker $USER

Install docker-compose

Linux basic commands

Check size directories

$ du -sh *

Search file

$ sudo find [path] -name "[filename]"

Unzip tar.gz using tar command

$ tar -xvzf filename.tar.gz

f: this must be the last flag of the command, and the tar file must be immediately after. It tells tar the name and path of the compressed file.
z: tells tar to decompress the archive using gzip
x: tar can collect files or extract them. x does the latter.

Drush export/import database

Drupal 6 and 7

$ drush cc
$ drush sql-dump > ~/my-sql-dump-file-name.sql

Drupal 8

$ drush cr
$ drush sql-dump > ~/my-sql-dump-file-name.sql

Download Database from the server

$ scp username@example.com:~/my-sql-dump-file-name.sql ~/projects

Import Database

$ drush sql-drop
$ drush sql-cli < ~/my-sql-dump-file-name.sql

Set up my local environment using Linux-mint

Install GIT

$ sudo add-apt-repository ppa:git-core/ppa
$ sudo apt-get update
$ sudo apt-get install git

set up your email and username

$ git config --global user.email "you@example.com"
$ git config --global user.name "Your Name"

Install Sublime

Open a terminal with Ctrl+Alt+T and type:

$ sudo add-apt-repository ppa:webupd8team/sublime-text-2
$ sudo apt-get update

Optional: remove any installed Sublime Text packages: