Skip to content

Instantly share code, notes, and snippets.

View thesuhu's full-sized avatar
💭
No one run like a fox

The Suhu thesuhu

💭
No one run like a fox
View GitHub Profile
@thesuhu
thesuhu / .mailrc
Last active October 30, 2021 15:20
Define Exchange mail aliases
# save in your home directory
set smtp-use-starttls
set ssl-verify=ignore
set nss-config-dir=/etc/pki/nssdb
set smtp=smtp.yourdomain.com:465
set smtp-auth=login
set smtp-auth-user=thesuhu@yourdomain.com
set smtp-auth-password=yourpassword
set from="thesuhu@yourdomain.com (The Suhu)"
@thesuhu
thesuhu / extract_digits.sql
Created December 12, 2021 05:02
Function to Get Digits from Strings in MySQL Version 8.0.3 or Below
DELIMITER $$
CREATE FUNCTION extract_digits (string_mixed VARCHAR(100)) RETURNS VARCHAR(100) NO SQL
BEGIN
DECLARE find_digit_position VARCHAR(100);
DECLARE string_digits VARCHAR(100) DEFAULT '';
DECLARE search_char VARCHAR(1);
DECLARE i INTEGER DEFAULT 1;
IF LENGTH(string_mixed) > 0 THEN
@thesuhu
thesuhu / install-curl-ubuntu.sh
Created December 15, 2021 15:38
Build and install cURL on Ubuntu
#! /bin/bash
# Already tested on Ubuntu 20.04
# Check the latest version at https://curl.se/download/
VERSION=7.80.0
cd ~
sudo apt-get update -y
sudo apt-get install -y nghttp2 libnghttp2-dev libssl-dev build-essential wget
wget https://curl.haxx.se/download/curl-${VERSION}.tar.gz
@thesuhu
thesuhu / work-with-oracle-tablespace.md
Last active December 16, 2021 07:35
Work With Oracle Tablespace

Work With Oracle Tablespace

# Written by The Suhu (2021).

# Tested on Oracle 12c

Short description

@thesuhu
thesuhu / getting-digits-from-string-in-mysql-or-oracle.md
Last active December 16, 2021 07:36
Getting Digits from String in MySQL or Oracle

Getting Digits from String in MySQL or Oracle

# Written by The Suhu (2021).

# Tested on MySQL 5.7.24, MySQL 8.0.23 and Oracle 12c

As an illustration I want to get data like this from a table.

@thesuhu
thesuhu / build-oracle-18c-xe-docker-image.md
Last active December 16, 2021 07:42
Build Oracle 18c XE Docker images

Build Oracle 18c XE Docker image

# Written by The Suhu (2021).

# Tested on Ubuntu Server 20.04
# Make sure you have enough disk space

Build image

@thesuhu
thesuhu / install-curl-centos.sh
Created December 16, 2021 12:11
Build and Install cURL on CentOS
#! /bin/bash
# Tested on CentOS 7 and CentOS 8
# Check the latest version at https://curl.se/download/
VERSION=7.80.0
cd ~
sudo yum update -y
sudo yum install wget gcc openssl-devel make -y
wget https://curl.haxx.se/download/curl-${VERSION}.tar.gz
@thesuhu
thesuhu / AxiosDownloadStreamExample.js
Created January 5, 2022 07:08
Axios Download File Stream and Write File
// You can simply use response.data.pipe and fs.createWriteStream to pipe response to file
const axios = require('axios')
// Example 1:
axios({
method: "get",
url: "https://xxx/my.pdf",
responseType: "stream"
}).then(function (response) {
response.data.pipe(fs.createWriteStream("/temp/my.pdf"))
@thesuhu
thesuhu / uninstall-or-remove-mysql-from-ubuntu.sh
Created February 3, 2022 17:24
Uninstall or Remove MySQL from Ubuntu
# Make sure MySQL is not running
sudo systemctl stop mysql
# Then purge all of the MySQL packages
sudo apt purge mysql-server mysql-client mysql-common mysql-server-core-* mysql-client-core-*
# Then delete all of the MySQL files
sudo rm -rf /etc/mysql /var/lib/mysql /var/log/mysql
# Finally clean all packages that are not needed:
@thesuhu
thesuhu / install-mysql-on-ubuntu.md
Last active September 1, 2022 08:08
How to Install MySQL on Ubuntu

How to Install MySQL on Ubuntu

This tutorial has been tested on Ubuntu 20.04 LTS.

Install latest version

Before install, don't forget to update package index in your server.

sudo apt update