Skip to content

Instantly share code, notes, and snippets.

View MakStashkevich's full-sized avatar
🍀
believe on the best

Maksim Stashkevich MakStashkevich

🍀
believe on the best
View GitHub Profile
@MakStashkevich
MakStashkevich / __root_folder.md
Created January 3, 2023 10:39
Dynamic header title & meta tags on NextJs 13
app/
- head.tsx
- layout.tsx
- page.tsx
- blog/[slug]/page.tsx
<?php
/**
* Multibyte String Pad
*
* Functionally, the equivalent of the standard str_pad function, but is capable of successfully padding multibyte strings.
*
* @param string $input The string to be padded.
* @param int $pad_length The length of the resultant padded string.
* @param string $pad_string The string to use as padding. Defaults to space.
(для Debian пути и команды могут отличаться)
sudo apt-get --purge remove mariadb*
sudo apt-get autoremove
sudo apt-get autoclean
если возникают ошибки при удалении -
заходим в папку /var/lib/dpkg/info
и удаляем там всё что начинается на mariadb и на mysql
повторяем предыдущие три команды
@MakStashkevich
MakStashkevich / es5.js
Created January 29, 2023 17:08 — forked from danieliser/es5.js
Convert Hex Color to rgba with opacity
/**
* ECMA2015
*/
function convertHex(hexCode, opacity = 1){
var hex = hexCode.replace('#', '');
if (hex.length === 3) {
hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
}
@MakStashkevich
MakStashkevich / -first-last-names.md
Created January 29, 2023 10:03 — forked from elifiner/-first-last-names.md
List of first names and last names for random data generation

First and last names

This gist has two files in it: first-names.txt and last-names.txt, each with 4096 names taken from some unnamed database.

Useful for generating mock data for testing or for opfuscating production data for testing.

See https://stackoverflow.com/a/50242368/15109 for some thoughts about data obfuscation.

@MakStashkevich
MakStashkevich / mysql-docker.sh
Created January 19, 2023 17:51 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@MakStashkevich
MakStashkevich / android_version_model.py
Created December 9, 2022 15:00 — forked from srs81/android_version_model.py
From useragent => find Android version, model, device (tablet/phone)
#
# Given a useragent string, return these results:
# Android version, device model name, type (tablet/phone)
#
import re
def android_details (useragent):
result = {}
result["aVersion"] = "Other"
result["amake"] = "Other"
@MakStashkevich
MakStashkevich / gist:edea6936c34d9a5f6e11610332a0e5d8
Created August 31, 2022 12:25 — forked from 1900/gist:3719878
send email in Python via SMTPLIB
import smtplib
import sys
import email.mime.text
mail_username='gmailUser@gmail.com'
mail_password='password'
from_addr = mail_username
to_addrs=('gmailUser@gmail.com')
HOST = 'smtp.gmail.com'
PORT = 25
@MakStashkevich
MakStashkevich / gist:1febdfaf40e11f88ce346491196b29bd
Created August 31, 2022 12:23 — forked from tejastank/gist:3096755
Python smtp email smtplib
import smtplib
to = '22.22@22.com'
gmail_user = '22222@gmail.com'
gmail_pwd = '22222'
smtpserver = smtplib.SMTP("smtp.gmail.com",587)
smtpserver.ehlo()
smtpserver.starttls()
smtpserver.ehlo
smtpserver.login(gmail_user, gmail_pwd)
@MakStashkevich
MakStashkevich / powershell.txt
Last active June 2, 2022 16:17
Подсчет количества строк кода и символов при помощи PowerShell
dir -Include *.js -Recurse | Measure-Object -Line -Character -Word -IgnoreWhiteSpace