Firewall. Open port for CentOS 7

Commands

1
2
3
4
5
6
7
systemctl status firewalld
firewall-cmd --state
firewall-cmd --get-services
firewall-cmd --info-service=service-name
ls /usr/lib/firewalld/services/
firewall-cmd --zone=public --permanent --add-port=8080/tcp
firewall-cmd --reload

Use this command to find your active zone(s):

1
firewall-cmd –get-active-zones

It will say either public, dmz, or something else. You should only apply to the zones required.

In the case of dmz try:

1
firewall-cmd –zone=dmz –add-port=2888/tcp –permanent

Otherwise, substitute dmz for your zone, for example, if your zone is public:

1
firewall-cmd –zone=public –add-port=2888/tcp –permanent

Then remember to reload the firewall for changes to take effect.

1
firewall-cmd –reload

Documentation

Recursive Query SQL

1
2
3
4
5
6
7
8
9
10
11
12
13
14
WITH MyTest as
(
SELECT P.ID, P.Parent_ID, CAST(P.ID AS VarChar(Max)) as Level
FROM table P
WHERE P.Parent_ID = 3

UNION ALL

SELECT P1.ID, P1.Parent_ID, CAST(P1.ID AS VarChar(Max)) + ', ' + M.Level
FROM table P1
INNER JOIN MyTest M
ON M.ID = P1.Parent_ID
)
SELECT * From MyTest

Apache commands

Working with apache on Centos.

  • Install apache

    1
    sudo yum install httpd
  • Start Apache. apachectl

    1
    sudo systemctl start httpd.service
    • Check where is installed

      1
      whereis httpd
    • Check apache status

      1
      sudo systemctl status httpd
    • Start apache on boot

      1
      sudo systemctl enable httpd.service
    • Stop apache

      1
      sudo systemctl stop httpd
    • Restart apache

      1
      sudo systemctl restart httpd.service

ffmpeg

FFmpeg is a free software project that produces libraries and programs for handling multimedia data. FFmpeg includes libavcodec, an audio/video codec library used by several other projects, libavformat (Lavf), an audio/video container mux and demux library, and the ffmpeg command line program for transcoding multimedia files. FFmpeg is published under the GNU Lesser General Public License 2.1+ or GNU General Public License 2+ (depending on which options are enabled).

The name of the project is inspired by the MPEG video standards group, together with “FF” for “fast forward”. The logo uses a zigzag pattern that shows how MPEG video codecs handle entropy encoding.

Installing

Instructions from vultr

  1. Update the system

    1
    2
    3
    sudo yum install epel-release -y
    sudo yum update -y
    sudo shutdown -r now
  2. Install the Nux Dextop YUM repo

    There are no official FFmpeg rpm packages for CentOS for now. Instead, you can use a 3rd-party YUM repo, Nux Dextop, to finish the job.

    • On CentOS 7, you can install the Nux Dextop YUM repo with the following commands:

      1
      2
      sudo rpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro
      sudo rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm
    • For CentOS 6, you need to install another release:

      1
      2
      sudo rpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro
      sudo rpm -Uvh http://li.nux.ro/download/nux/dextop/el6/x86_64/nux-dextop-release-0-2.el6.nux.noarch.rpm
  3. Install FFmpeg and FFmpeg development packages

    1
    sudo yum install ffmpeg ffmpeg-devel -y
  4. Test drive

    1. Confirm the installation of FFmpeg:

      1
      ffmpeg

      This command provides detailed info about FFmpeg installed on your system. At the time of writing, the version of FFmpeg installed using Nux dextop is 2.6.8.
      If you want to learn more about FFmpeg, input:

      1
      ffmpeg -h
    2. Convert an mp3 audio file to an ogg audio file.
      You need to determine the appropriate parameters when using FFmpeg. For example, you can convert an mp3 file to an ogg file using the following commands:

      1
      2
      3
      cd
      wget https://archive.org/download/MLKDream/MLKDream_64kb.mp3
      ffmpeg -i MLKDream_64kb.mp3 -c:a libvorbis -q:a 4 MLKDream_64kb.ogg
    3. Convert an flv video file to an mp4 video file.

      Here is an example of lossless conversion from flv to mp4:

      1
      2
      3
      cd
      wget https://archive.org/download/beeenieilp/beeen.flv
      ffmpeg -i beeen.flv -y -vcodec copy -acodec copy beeen.mp4

ffmpeg cheatsheets

TensorFlow

TensorFlow is an open source software library for numerical computation using data flow graphs. Nodes in the graph represent mathematical operations, while the graph edges represent the multidimensional data arrays (tensors) communicated between them. The flexible architecture allows you to deploy computation to one or more CPUs or GPUs in a desktop, server, or mobile device with a single API. TensorFlow was originally developed by researchers and engineers working on the Google Brain Team within Google’s Machine Intelligence research organization for the purposes of conducting machine learning and deep neural networks research, but the system is general enough to be applicable in a wide variety of other domains as well.

TensorBoard

TensorBoard is a suite of web applications for inspecting and understanding your TensorFlow runs and graphs.

Visualizing Data using t-SNE

t-distributed stochastic neighbor embedding (t-SNE) is a machine learning algorithm for dimensionality reduction developed by Geoffrey Hinton and Laurens van der Maaten. It is a nonlinear dimensionality reduction technique that is particularly well-suited for embedding high-dimensional data into a space of two or three dimensions, which can then be visualized in a scatter plot. Specifically, it models each high-dimensional object by a two- or three-dimensional point in such a way that similar objects are modeled by nearby points and dissimilar objects are modeled by distant points.

Installation

1
pip install tensorflow

TensorFlow Examples

Running sample of TensorBoard

TensorBoard embedding sample

Markdown Language

Markdown is a lightweight markup language with plain text formatting syntax. It is designed so that it can be converted to HTML and many other formats using a tool by the same name. Markdown is often used to format readme files, for writing messages in online discussion forums, and to create rich text using a plain text editor.
John Gruber created the Markdown language in 2004 in collaboration with Aaron Swartz on the syntax, with the goal of enabling people “to write using an easy-to-read, easy-to-write plain text format, and optionally convert it to structurally valid XHTML (or HTML)”

Example

1
2
3
4
5
# Heading

## Sub-heading

### Another deeper heading

Markdown Cheat Sheet

Hexojs

Hexo es un static site generator creado con nodeJS, node permite una navegacion muy rápida, incluso con sitios extremadamente grandes. Hexo se centra en ser un blog framework que es altamente extensible, con soporte completo para los complementos Octopress, y muchos otros complementos Jekyll con un mínimo de ajustes.

Hexo-cli

Hexo tiene una interfaz de comandos para instalar o realizar distintas operaciones
hexo-cli

Markdown

Hexo utiliza el lenguaje Markdown para la publicación.

Instalación

1
2
3
4
5
npm install hexo-cli -g
hexo init blog
cd blog
npm install
hexo server

Themes

Hexo tiene muchos diseños con themes, este sitio usa cactus-dark

Saludos.