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)

Thursday 21 December 2023

MySQL general query log

To add the general log, add the following entries into the cnf ile;

general_log_file        = /var/log/mysql/mysql.log

general_log             = 1

The logging can also be stated and stopped from the command line;

SET GLOBAL general_log = 'OFF';
SET GLOBAL general_log = 1; 
 
See also here 

Tuesday 5 September 2023

Change date format in Thunderbird

If the normal SETTINGS > GENERAL . LANGUAGE&APPEARANCE . DATE&TIME&FORMATTING doesn't work then do;

SETTINGS > GENERAL . CONFIG EDITOR and type;

intl.date_time.pattern_override.date_short

Select string type and add the format, for example dd-MM-yyyy

Save and restart.

[source]

Wednesday 30 August 2023

HTML mouse over hover text

The following examples should work;

<td title="Look at me" >Hover Over me</td>
<p title="Look at me" >Hover Over me</p> 
// We can also use php in there, like the below; 
<td title="<?= get_message_text($row['MESSAGE_NO']) ?>"><?= $row['MESSAGE_NO'] ?></td>
 

Thursday 17 August 2023

Convert asf format videos using ffmpeg and ffprobe in Linux

Basic conversion would be as below;

ffmpeg -i input.asf output.avi

If we wanted to change the resolution, we would first do;

ffprobe -v error -select_streams v:0 -show_entries stream=width,height -of csv=s=x:p=0 input.asf

which would show us the original resolution, we could then set the resolution of the output as below;

ffmpeg -i input.asf -vf scale=704x506 output.avi


Wednesday 16 August 2023

MySQL paging or scrolling

We can use the following to prevent query results from scrolling to the end of the results;

\P /usr/bin/less

or alternatively;

pager less -S

This will act like grepping a file to less (cat somefile | less)

\n or nopager will return to normal.

Additionally, we can use the \G at the end of a query to output results vertically, say we have too many columns. For example show slave status\G;


Wednesday 9 August 2023

monit summary showing "error connecting to the monit daemon"

I've had this several times and while it's been an issue, it's never really bothered me enough to investigate. I have however since found this to be a result of there being no "lo" interface up. when running ifconfig it was missing, so simply bringing this up by ifup lo resolved.

Clear bash history

history -c && history -w

[source]

Thursday 3 August 2023

Thursday 13 July 2023

Network Configuration in OpenBSD

Edit /etc/rc.conf

Change

ifconfig_em0="DHCP"

to

ifconfig_em0="inet 192.168.56.105 netmask 255.255.25.0"

and add

defaultrouter="192.168.56.1"

edit /etc/resolve.conf as per Linux and then do;

service netif restart && service routing restart

[source]

 

Tuesday 20 June 2023

Copy file To Remote using ssh

scp

To copy a file from one local machine to a remote machine using ssh, do the following;

scp /local/path/to/file username@ip_address:/path/to/remote/destination

or if we wish to get a file from a remote machine to the local machine, we can do;

scp username@ip_address:/path/to/remote/file /local/path/to/destination

 

Wednesday 31 May 2023

Add static route to windows

To add a static route to windows, do the following;

route add destination mask gateway metric interface

route add 23.128.16.0 255.255.240.0 23.128.16.1 IF 13

Note, in the above we are ignoring the metric.

The interface number can be found from;

netsh interface ipv4 show interfaces

Monday 1 May 2023

Selecting distinct columns with MySQL

In the past I was sure it was not possible in MySQL to use DISTINCT on multiple columns, such as below;

SELECT DISTINCT a,b FROM my_table;

and have in the past, instead used something similar to the below as a workaround;

SELECT DISTINCT CONCAT (a,' ', b) FROM my_table;

However, it seems I am remiss and MySQL does indeed support DISTINCT on multiple columns.

 

Monday 24 April 2023

Windows shares not connecting from Thunar in Linux

I came across an issue where Windows network shares would not open using Thunar file manager in Slackware.

With a fair bit of digging around, I eventually downgraded samba from 4.15.13 to 4.15.5 which in my case was what was installed with Slackware 15.


Monday 20 March 2023

Cell Background colour not showing in LibreOffice Calc

This can be resolved in Tools>Options>LibreOffice>Accessibility and ensuring that Options For High Contrast Appearance is Disabled, as below;

Monday 6 March 2023

Add custom command to nagios

 In this example, we add the plugin to check MySQL replication status [source]

Show mysql variables

We can show mysql variables with the following;

SHOW VARIABLES WHERE variable_name = 'some_variable';

SHOW VARIABLES LIKE '%some_variable%';

Example, to show the number of days binary logs are retained for;

SHOW VARIABLES WHERE variable_name = 'expire_logs_days';

Sunday 19 February 2023

Set date as a string

The following format allows you to set the current date from a string;

sudo date -s '2023-01-14 11:22:00'

where the above date refers to 14th Jan 2023

Friday 17 February 2023

Upgrading Debian 6 kernel

Attempts to do this through apt-get involved upgrading too many packages and in my opinion, was too risky. Therefor, an upgrade from Squeeze to Wheezy was done this way and from there, a kernel [5.15.94] was built on another box, in my case a Debian 11 VM running kernel [5.10.0-21]

Debian Archive

Debian archive for sources.list

http://archive.debian.org/debian-archive/debian/dists/ 

The sources.list file may look like (need to check the deb-src entries);

deb http://archive.debian.org/debian-archive/debian/ squeeze main non-free contribs

deb-src http://archive.debian.org/debian-archive/debian/ squeeze main non-free contribs

deb http://archive.debian.org/debian-archive/debian/ wheezy main non-free contribs

deb-src http://archive.debian.org/debian-archive/debian/ wheezy main non-free contribs

deb http://archive.debian.org/debian-archive/debian/ jessie main non-free contribs

deb-src http://archive.debian.org/debian-archive/debian/ jessie main non-free contribs

deb http://deb.debian.org/debian/ buster main non-free contribs

deb-src http://deb.debian.org/debian/ buster main non-free contribs


See also https://wiki.debian.org/SourcesList

Wednesday 15 February 2023

Boot from GRUB commandline

There may be occasions where we need to boot manually from the GRUB menu and perhaps realize that you should just have installed LILO in the first place :)

Monday 13 February 2023

Unable to boot system restored with fsarchiver

 TBA:

GRUB - Embedding is not possible


The following is the output of fdisk -l on both the machine to which the original backups were taken and also a machine to which a successful restoration has been carried out. In the case of the latter, both a physical and a VM.

FEC-A

FEC-B

The df output is the same for both physical machines, as in the device is /dev/cciss/c0d0p* which the VM follows the /dev/sda* format, which perhaps makes sense since the physical machines are the same and both have the same raid controller.



Tuesday 24 January 2023

Multi cursor in VS code

 To put the cursor at the end of all lines in VS code, firstly, select all text and then do SHIFT+ALT+i

Additionally, to select multiple cursors anywhere in a vertical line, firstly, click the start point and then using SHIFT+CTRL click the second point

Thursday 12 January 2023

Slackware 15 install on Thinkpad p53

The following is my account of installing Slackware 15 onto a Lenovo ThinkPad P53


Wednesday 11 January 2023

Add Java to system PATH variable

 This method seems to work best for me;

There is a script /etc/profile that sets up environment variables and that also includes any scripts in /etc/profile.d so I chose to create a file /etc/profile.d/java.sh with 755 permissions with the following contents;

export JAVA_HOME="/opt/jdk1.8.0_341"
export PATH=$JAVA_HOME/bin:$PATH


Saturday 7 January 2023

Find out which DNS server you're using

 On, we can check /etc/resolv.conf but how do we know which IP is actually being used?

slackpkg+ Slackware Package Manager Module

 This relates to the module for Slackpkg called slackpkg+ which can be found here

slackpkg+ is a module for slackpkg which allows the for the installation of packages from of 3rd party repositories in Slackware. Note: dependency checking is not included.