Skip to content

Instantly share code, notes, and snippets.

View al-mighty's full-sized avatar
🫥

Вячеслав al-mighty

🫥
View GitHub Profile
@al-mighty
al-mighty / shop.ts
Last active March 18, 2025 12:46
shop
/**
The task is to implement the Shop protocol (you can do that in this file directly).
- No database or any other storage is required, just store data in memory
- No any smart search, use String method contains (case sensitive/insensitive - does not matter)
– Performance optimizations are optional
*/
interface Product {
id: string;
name: string;
@al-mighty
al-mighty / mysql-docker.sh
Created February 9, 2022 11:00 — 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
var Distance = 1900/1000;
var Speed = 6;
var H = {value:0}
var M = {value:0}
var S = {value:0}
var unit_distance = 1000;
var unit_speed = 1;
var Time = (Distance * unit_distance * 3.6) / (Speed * unit_speed);
H.value = parseInt(Time / 3600);
M.value = parseInt((Time - (parseInt(Time / 3600)*3600)) / 60);
@al-mighty
al-mighty / fix_exfat_drive.md
Created September 21, 2020 10:47 — forked from scottopell/fix_exfat_drive.md
Fix corrupted exFAT disk macOS/OSX

exFAT support on macOS seems to have some bugs because my external drives with exFAT formatting will randomly get corrupted.

Disk Utility is unable to repair this at first, but the fix is this:

  1. Use diskutil list to find the right drive id.
  2. You want the id under the IDENTIFIER column, it should look like disk1s1
  3. Run sudo fsck_exfat -d <id from above>. eg sudo fsck_exfat -d disk1s3
  4. -d is debug so you'll see all your files output as they're processed.
  5. Answer YES if it gives you the prompt Main boot region needs to be updated. Yes/No?
@al-mighty
al-mighty / fix_exfat_drive.md
Created September 21, 2020 10:47 — forked from scottopell/fix_exfat_drive.md
Fix corrupted exFAT disk macOS/OSX

exFAT support on macOS seems to have some bugs because my external drives with exFAT formatting will randomly get corrupted.

Disk Utility is unable to repair this at first, but the fix is this:

  1. Use diskutil list to find the right drive id.
  2. You want the id under the IDENTIFIER column, it should look like disk1s1
  3. Run sudo fsck_exfat -d <id from above>. eg sudo fsck_exfat -d disk1s3
  4. -d is debug so you'll see all your files output as they're processed.
  5. Answer YES if it gives you the prompt Main boot region needs to be updated. Yes/No?
var size = Object.keys(myObj).length;
@al-mighty
al-mighty / git-logout
Created February 4, 2019 02:02 — forked from bas-ie/git-logout
#!/bin/bash
# Logout current GitHub credentials and remove global user.name, user.email
echo -e "host=github.com\nprotocol=https\n" | git credential-osxkeychain erase
git config --unset-all --global user.name
git config --unset-all --global user.email
@al-mighty
al-mighty / deploy.sh
Created December 3, 2018 21:45 — forked from kcabading/deploy.sh
Bash script for deploying Wordpress using Jenkins and Bitbucket.
#!/bin/bash
# PLACEHOLDERS
# [STAGING_FOLDER] - staging directory in your server
# [STAGING_URL] - staging url
# [STAGING_USER] - staging user in the server
# [STAGING_MYSQLUSER] - staging mysql user
# [STAGING_MYSQLPASSWORD] - staging mysql password
# [ROOTUSER] - Mysql root user
# [ROOTPASSWORD] - Mysql root password
@al-mighty
al-mighty / kill-all-php-fpm.sh
Created September 4, 2018 23:09 — forked from bmichalski/kill-all-php-fpm.sh
Kill all php-fpm processes
sudo kill -9 `sudo ps -ef | grep php-fpm | grep -v grep | awk '{print $2}'`
Date.prototype.daysInMonth = function() {
return 33 - new Date(this.getFullYear(), this.getMonth(), 33).getDate();
};
var myDate = new Date();
myDate.setMonth(01);
myDate.setFullYear(2020);
console.log(myDate.daysInMonth());