Labels

Android (1) bash (2) boost (2) C (34) C++ (2) cheatsheet (2) CLion (6) css (3) Debian (33) DL (17) Docker (1) Dreamweaver (2) Eclipse (3) fail2ban (4) git (5) GitHub (4) Hacking (3) html (8) http (1) iOS (1) iPad (1) IRC (1) Java (30) javascript (3) Linux (164) Mac (19) Machine Learning (1) mySQL (47) Netbeans (4) Networking (1) Nexus (1) OpenVMS (6) Oracle (1) Pandas (3) php (16) Postgresql (8) Python (9) raid (1) RedHat (14) Samba (2) Slackware (45) SQL (14) svn (1) tar (1) ThinkPad (1) Virtualbox (3) Visual Basic (1) Visual Studio (1) Windows (2)

Saturday 26 September 2020

SSH as root

If you really want to ssh at root;

edit /etc/ssh/sshd_config

Friday 25 September 2020

Apache, php, mySQL and phpMyAdmin install on Debian

See also here for Slackware configuration.

To install and configure apache, MySQL and phpMyAdmin

Wednesday 23 September 2020

Install ifconfig on Debian

 apt-get install net-tools

MySQL views

The basic syntax to create a view is as follows;

CREATE VIEW view_name
AS
SELECT something, somethingElse
FROM someTable;

Saturday 19 September 2020

Xdebug install and configuration for use with PhpStrom

To enable and configure Xdebug for use with PhpStorm

This was carried out on my Mac, yet to be tested under Linux.

Friday 18 September 2020

Linux links

Quick reminder on links in Linux


ln -s sourceFile linkFile (soft link or symbolic link)

ln sourceFile linkFile (hard link)

DL - Messages

 

Friday 11 September 2020

Wednesday 9 September 2020

Monday 7 September 2020

DL - Query to check for missing gas cut stamping details

A reminder of why I used a combination of JOIN and INNER JOIN

This serves as a decent example of this.

CLion CYGWIN warning - TODO

TODO

sudo

A quick reminder on adding a user to the sudo file.


We want to use visudo as root to edit the /etc/sudoers file.

we add our user as follows;

username ALL=(ALL) ALL

Saturday 5 September 2020

Run a C program as a daemon in Linux

Tested on Slackware 14.2 (to be tested on Debian)

Mostly from here

The complete working skeleton code can be found here 

When launched, this will live for 20 seconds and then terminate, logging startup and exit messages to /var/log/messages not syslog as expected on Slackware 14.2 but verified to write to /var/log/syslog on Debian 10.5

This can be pulled from: https://github.com/plisken1/daemon_template.git

Run a shell script (or an application) as a daemon in Linux

This is aimed at Linux systems running systemd (Debian and RedHat), mostly from here 

See my other blog post here

Writing to the message log in Linux with C

 The following is an example of writing to the message log in Linux with C

from here, maybe here and also here if you are feeling brave.

#include <syslog.h>

#include <stdio.h>


int main()

{


setlogmask (LOG_UPTO (LOG_NOTICE));


openlog ("myprogramlog", LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL1);


for (int x=0;x<10;x++)

   {

   syslog (LOG_NOTICE, "Program started, count = %d",x);

   syslog (LOG_INFO, "A tree falls in a forest");

   }


closelog ();


return 0;


}

Linux Daemon Writing HOWTO

 The following is a copy of the document from here

Linux Daemon Writing HOWTO

Devin Watson

v1.0, May 2004
This document shows how to write a daemon in Linux using GCC. Knowledge of Linux and a familiarity with C are necessary to use this document. This HOWTO is Copyright by Devin Watson, under the terms of the BSD License.

Friday 4 September 2020

Build C++ app in CLion for Linux (including a MySQL application)

How to build a C++ application, using MySQL and deploy on Linux.

In this case, we are using Debian 10 (also works on Slackware 14.2)

We are building an application (example can be found here, albeit slightly modified but importantly includes mysql.h). Also on GitHub here 

MySQL install on Debian & solution to mysql-config not found.

To install mysql server on Debian

apt-get install mariadb-server

To start, run;

service mysql start

I also found mysql_config not to be found on Debian 10

likely due to the development stuff not being installed as I could also not find /usr/include/mysql

so, installing and resolving is as follows;

sudo apt-get install libmariadb-dev-compat

also worthwhile maybe;

alp-get install libmysqlcppconn-dev

apt-get install libmysql++

Wednesday 2 September 2020