Generate Large Test Files in Windows

Open an administrative level command prompt. 

Run the following command:

fsutil file createnew <file> <size in bytes>

For example, this command will create a 1GB file called 1gb.test on my desktop:

fsutil file createnew c:\users\steve\desktop\1gb.test 1073741824

The key is to input the size of the file in bytes so here are some common file sizes to save you from math:

1 MB = 1048576 bytes
100 MB = 104857600 bytes
1 GB = 1073741824 bytes
10 GB = 10737418240 bytes
100 GB =107374182400 bytes
1 TB = 1099511627776 bytes
10 TB =10995116277760 bytes
Share

Delete/Purging mysql-bin (binlog) files safely

The file mysql-bin.index keeps a list of all binary logs mysqld has generated and auto-rotated. The mechanisms for cleaning out the binlogs in conjunction with mysql-bin.index are:

PURGE BINARY LOGS TO ‘binlogname’;
PURGE BINARY LOGS BEFORE ‘datetimestamp’;

These will clear all binary logs before the binlog or timestamp you just specified. For example, if you login to mysql run

mysql> PURGE BINARY LOGS TO ‘mysql-bin.000223’;

this will erase all binary logs before ‘mysql-bin.000223’.

If you run

mysql> PURGE BINARY LOGS BEFORE DATE(NOW() – INTERVAL 3 DAY) + INTERVAL 0 SECOND;

this will erase all binary logs before midnight 3 days ago.

If you want to have binlog rotated away automatically and keep 3 days woth, simply set this:

mysql> SET GLOBAL expire_logs_days = 3;

then add this to /etc/my.cnf

[mysqld]
expire-logs-days=3

Share

MySQL: Show Users, Privileges and Passwords

Show all MySQL users:

mysql> SELECT user FROM mysql.user;

List only unique user names:

mysql> SELECT DISTINCT user FROM mysql.user;

Show MySQL users and hosts they are allowed to connect from:

mysql> SELECT user,host FROM mysql.user;

Show MySQL users, their passwords and hosts:

mysql> SELECT user,host,password FROM mysql.user;

in MySQL 5.7 and higher:

mysql> SELECT host,user,authentication_string FROM mysql.user;

Show privileges granted to the current MySQL user:

mysql> SHOW GRANTS;

Show privileges granted to the MySQL user (if you don’t specify a host for the user name, MySQL assumes % as the host):

mysql> SHOW GRANTS FOR 'user_name';

Show privileges granted to a particular MySQL user account from a given host:

mysql> SHOW GRANTS FOR 'user_name'@'host';

– e.g. –

mysql> SHOW GRANTS FOR 'root'@'localhost';
mysql> SHOW GRANTS FOR 'root'@'%';
mysql> SHOW GRANTS FOR 'admin'@'192.168.0.1';
Share

Wget, Apt and Git behind proxy

For Wget

Add/Comment out below line(s) in file ~/.wgetrc or /etc/wgetrc:

http_proxy = http://[Proxy_Server]:[port]
https_proxy = http://[Proxy_Server]:[port]
ftp_proxy = http://[Proxy_Server]:[port]

For Apt

Create a new configuration file named proxy.conf.sudo touch /etc/apt/apt.conf.d/proxy.conf
Open the proxy.conf file in a text editor.sudo vi /etc/apt/apt.conf.d/proxy.conf

Paste it as following:

Acquire {
HTTP::proxy "http://127.0.0.1:8080";
HTTPS::proxy "http://127.0.0.1:8080";
}

For Git:

git config --global http.proxy http://proxyuser:proxypwd@proxy.server.com:8080

change proxyuser to your proxy user
change proxypwd to your proxy password
change proxy.server.com to the URL of your proxy server
change 8080 to the proxy port configured on your proxy server
Note that this works for both http and https repos.

If you decide at any time to reset this proxy and work without proxy:

Command to use:

git config --global --unset http.proxy

Finally, to check the currently set proxy:

git config --global --get http.proxy
Share

How to import a certificate into WorldClient

WorldClient’s web server currently does not support generating certificate requests. If you have IIS you can use its certificate wizard to create the request and import the response. WorldClient will then be able to use it. You do not need to continue to use IIS at that point, you can disable the service and continue to use WorldClient’s built-in webserver.

If you have purchased or otherwise generated a certificate from some source other than MDaemon, you can still use that certificate by using the Microsoft Management Console (MMC) to import it into the certificate store that MDaemon uses.

Read more

Share

How to fix CentOS 5 or 6 error: YumRepo Error: All mirror URLs are not using ftp, http[s] or file

The error looks like-

And here goes the resolution (please carefully update/use the exact CentOS version you are using, in my case it was CentOS 6.9)

1. Go to /etc/yum.repos.d/ directory:

# cd /etc/yum.repos.d/

2. Make copy of original file:

# cp CentOS-Base.repo CentOS-Base.repo.old

3. Open and edit file with any text editor:

# vi CentOS-Base.repo looks

4. After editing it should looks like:

Read more

Share

Force Stop Proxmox LXC

First try to unlock the pct (assuming your troubled container is 101):

pct unlock 101

if it works just stop and start again the vm. if it does’nt work (my case) try to stop with this

lxc-stop --name 101

if it’s does’nt work (my case) you can force stop with kill command

ps ax | grep lxc

then kill the process with your id (101 for me) kill pid (replace pid by the process name). After that you can just launch again you’r vm

Share

Install OnlyOffice Document Server on Ubuntu 16

Step 1: Install ONLYOFFICE Document Server

Please note that OnlyOffice document server requires at least 2GB of RAM. An additional 2GB of swap space is recommended. OnlyOffice document server depends on PostgreSQL, Node.js, Redis Server, RabbitMQ server and Nginx. The following steps are tested on a Ubuntu 16.04 server but should also be applicable to other Debian-based Linux distributions.

Install PostgreSQL from Ubuntu repository

sudo apt install postgresql

Then create the onlyoffice database.

sudo -u postgres psql -c "CREATE DATABASE onlyoffice;"

Create the onlyoffice user.

sudo -u postgres psql -c "CREATE USER onlyoffice WITH password 'onlyoffice';"

Grant permission.

Read more

Share

Installing wkhtmltopdf on Debian 7.8

Installing wkhtmltopdf on Debian 7.8 to dynamically create PDF documents from HTML.

apt-get update
aptitude install xfonts-base xfonts-75dpi fontconfig
mkdir ~/src/wkhtmltopdf -p
cd ~/src/wkhtmltopdf
wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.2.1/wkhtmltox-0.12.2.1_linux-wheezy-amd64.deb
dpkg -i wkhtmltox-0.12.2.1_linux-wheezy-amd64.deb

Src:
https://fedir.github.io/web/blog/2015/09/01/install-wkhtmltopdf-on-debian-7.8
https://github.com/wkhtmltopdf/wkhtmltopdf/releases/0.12.2.1/
https://github.com/wkhtmltopdf/packaging/releases/0.12.6-1
https://stackoverflow.com/questions/38262173/how-to-correctly-install-wkhtmltopdf-on-debian-64-bit

Share