Skip to content

Instantly share code, notes, and snippets.

View acrossoffwest's full-sized avatar
🎯
Focusing

Yurij Karpov acrossoffwest

🎯
Focusing
View GitHub Profile
<?php
namespace App\Console\Commands;
use App\Models\Burword;
use App\Models\BurWordSpeech;
use App\Services\WordsElasticSearch;
use Carbon\Carbon;
use Illuminate\Console\Command;
@acrossoffwest
acrossoffwest / buryad-words.txt
Last active December 13, 2022 20:20
Бурятские слова
hoohoo
hаphата
hаа
hаагдаhан
hаадагаа
hаалта
hаам
hаань
hаатуулааб
hабан
@acrossoffwest
acrossoffwest / discord.users.js
Created May 10, 2022 18:15
Get all discord users
const waiter = (cb, waitSeconds = 1) => new Promise(async (resolve) => {
setTimeout(async () => {
const result = await cb();
resolve(result);
}, waitSeconds * 1000);
});
const extractUsers = async (tabName = 'all', listClass = 'peopleList', itemClass = 'peopleListItem') => {
return waiter(() => document.querySelector('[class^="childWrapper"]').click())
.then(() => waiter(() => document.querySelector('[class^="nameAndDecorators"]').click()))
.then(() => waiter(() => document.querySelector(`[aria-controls="${tabName}-tab"]`).click()))
@acrossoffwest
acrossoffwest / run.sh
Created November 5, 2021 13:19
Run Spring Boot App with docker/.env variables
#!/bin/bash
RUN_DOCKER_COMPOSE="cd docker/ && docker-compose up -d"
if [ "$1" == "-d" ]; then
eval $RUN_DOCKER_COMPOSE
elif [ "$1" == "-msld" ]; then
msl "$RUN_DOCKER_COMPOSE"
fi
set -o allexport
<?php
namespace App\Rules\Contracts;
use Closure;
use Illuminate\Contracts\Validation\Rule;
interface RuleClosureContract extends Rule
{
<?php
if (!function_exists('load_class_names_from_dir')) {
function load_class_names_from_dir(string $dir): array
{
$files = scandir($dir);
if (!$files) {
return [];
}
return array_filter(array_map(function ($filename) use ($dir) {
$extension = '.php';
@acrossoffwest
acrossoffwest / msl
Created July 31, 2021 21:30
Command for login into ubuntu server of parallels desktop. Locate it in /usr/local/bin/msl
#!/bin/bash
START_DIR=$(pwd)
ssh -t acrossoffwest@localhost "cd $START_DIR; bash --login"
#!/bin/bash
if [[ ! `which acl` ]]; then
if [[ `which apk` ]]; then
apk add acl
elif [[ `which apt` ]]; then
apt update
apt install -y acl
elif [[ `which apt-get` ]]; then
apt-get update
@acrossoffwest
acrossoffwest / create-user-with-sudo.sh
Last active March 20, 2021 16:08 — forked from ivanrad/install-user-to-sudoersd.sh
Create user with sudoers (ALL NOPASSWD)
#!/bin/bash
[ $UID -eq 0 ] ||
{ echo "This script needs to be run with sudo -- \"sudo `basename $0`\"."; exit 1; }
SUDOERS_USERNAME=$1
[ -z $SUDOERS_USERNAME ] && { echo "error SUDO_USER env variable is not set."; exit 1; }
adduser $SUDOERS_USERNAME
@acrossoffwest
acrossoffwest / ldcb
Last active July 21, 2021 12:28
Laravel Docker Compose Bash - tools for fast enter in bash of specific docker container
#!/bin/bash
POSITIONAL=()
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
-f|--force)
FORCE="TRUE"