stephenwenceslao's blog

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

How to fix allan single coinslot sensor malfunction

If you experience na ung allan coinslot niyo is hindi mag accept ng coins or nag mamalfunction.
TRY THIS FIX, Lagyan niyo lng ng black ink/paint ung sa may sensor para mag block sa mga noise light surrounding. Ung black ink/paint gamit niya pra mag focus lng sa light nong LED ng sensor.

HOPE THIS WILL HELP YOU :)

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.

Why RC snubber is very important?

If you have created your own circuit which run from a microcontroller. You want to control your appliances, motor or any AC load. You probably notice some issue regarding a relay when you control the AC load.

When there is no load in the relay, the circuit runs fine. Now what if we put some load in the relay like a motor. You might notice that the circuit has some issue like it will reset itself or some abnormalities from the circuit.

This where the RC snubber is very important, you just put a RC snubber to the output of the relay. Just what I did in my circuit.

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

Raspberry pi 3 install raspbian jessie lite

Download raspbian jessie @raspberry pi official website https://www.raspberrypi.org/downloads/raspbian/

Format your sd card to FAT32

Im using linux to copy the img file to the sd card

$ sudo dd bs=4M if=2017-06-21-raspbian-jessie.img of=/dev/sdx status=progress

When your sd card is not showing using

$ sudo fdisk -l

try to run this

$ lsusb

see if the usb is listed.

 

Drush export sql-dump gzip

$ drush sql-dump --gzip --result-file=~/path-here/sql-dump.sql

I created my own shell script dump_db.sh to make less hustle.
Inside my dump_db.sh

#!/bin/bash

if [ -z "$1" ];
then
  echo "Please specify if its dev or prod" 
  exit 1
else
  dev="$1"
fi

if [ -z "$2" ];
then 
  echo "Please specify the database name"
  exit 1
else
  db="$2"
fi

echo "Exporting database"
drush sql-dump --gzip --result-file=~/backup/$(date +%Y%m%d-%H.%M)-"$dev"-"$db".sql

I would run this:

$ source dump_db.sh dev drupalista.net

Drupal 7 boost installation

1. Download boost module and enable.

2. Disable page anonymous core cache, Configure boost settings and .htaccess settings.

3. Copy .htaccess generated to drupal root .htaccess

If can't login update boost .htaccess

from

RewriteRule .* - [S=4]

to

RewriteRule .* - [S=1]

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;