Skip to content

Instantly share code, notes, and snippets.

@laam-egg
laam-egg / install-micro.sh
Last active January 31, 2026 17:07
Install micro editor on Ubuntu - my configuration
#!/bin/sh
set -e
# Install micro
curl -fsSL https://getmic.ro | bash
sudo mv ./micro /usr/local/bin/edit
# Config directories
install -d ~/.config/micro
sudo install -d /root/.config/micro
@laam-egg
laam-egg / fix-mysql-bad-handshake.md
Created May 17, 2025 16:22
Fix MySQL connection error "Bad Handshake"

Fix MySQL connection error "Bad Handshake"

This problem has multiple causes. Read the initial instructions under each solution below to ensure you're on the right track.

Maybe you need 5.7 :)

You're working on a legacy project? Check the version of the production database using SELECT VERSION(). If it is indeed 5.7 then this is the right path to follow!

@laam-egg
laam-egg / install-php-on-ubuntu-mint.sh
Last active July 22, 2025 09:38
Install PHP on Ubuntu, Linux Mint. Enter your desired PHP version e.g. 7.4, 8.2, 8.3 etc. Must be run with sudo. See line 34 for a list of PHP extensions installed.
#!/bin/sh
set -e
##########################
## RUN THIS WITH SUDO ! ##
##########################
read -p "Enter PHP version (e.g. 7.4 or 8.2): " PHP_VERSION
echo "INSTALLING PHP ${PHP_VERSION}..."
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Lab4 Guide (on an Ubuntu-based host)

Terminology

  • Host: YOUR REAL machine
  • VM: a virtual machine in VirtualBox, which runs on Host.
  • Instance: an OpenStack instance running inside a VM, which in turn runs on Host.

Preparation

import sys
sys.set_int_max_str_digits(2147483647) # 2^31 - 1
def extended_euclidean(a: int, b: int) -> tuple[int, int, int]:
"""Returns (d, x, y)"""
if b == 0:
return (a, 1, 0)
// https://code.ptit.edu.vn/student/question/C07006
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
struct Diem {
double x;
double y;
// https://code.ptit.edu.vn/student/question/C07006
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
double tinhSTamGiac(double a, double b, double c) {
return 0.25 * sqrt(
(a+b+c) * (a+b-c) * (b+c-a) * (c+a-b)
/**
* CHỮ SỐ 2
* Viết chương trình nhập vào một số nguyên dương N (N <= 10^18),
* in ra 1 nếu N chứa chữ số 2, 0 nếu N không chứa chữ số 2 nào.
* INPUT:
* Dòng 1: số nguyên T là số bộ test
* T dòng tiếp theo: mỗi dòng là một số nguyên N.
* OUTPUT:
* T dòng, mỗi dòng in ra 1/0 tương ứng với số N đã nhập.
*/
/**
* TÊN NGƯỜI VIỆT
* Tên người Việt (thông thường) không có các chữ cái F, J, W,
* và Z (cả hoa và thường).
* Viết chương trình nhập vào họ và tên, in ra 1 nếu tên đó
* là tên người Việt, 0 nếu tên đó không phải là tên người Việt.
* INPUT:
* Dòng 1: số nguyên T là số bộ test
* T dòng tiếp theo: mỗi dòng là một họ và tên.
* OUTPUT: