Skip to content

Instantly share code, notes, and snippets.

View eryshkov's full-sized avatar
🌏
Working hard

Evgenii Ryshkov eryshkov

🌏
Working hard
View GitHub Profile
@eryshkov
eryshkov / docker-ip.sh
Created October 1, 2022 18:57
Get all docker IPs
docker ps -q | xargs -n 1 docker inspect --format '{{ .Name }} {{range .NetworkSettings.Networks}} {{.IPAddress}}{{end}}' | sed 's#^/##';
@eryshkov
eryshkov / json_decode_datetime.php
Created December 21, 2021 07:45 — forked from dextervip/json_decode_datetime.php
Auto decode DateTime Objects in json_decode PHP
<?php
$data = json_decode($message->getBody(), true);
function array_map_recursive($callback, $array)
{
$func = function ($item) use (&$func, &$callback) {
if(is_array($item) && isset($item['date']) && isset($item['timezone_type'])){
return call_user_func($callback, $item);
}
return is_array($item) ? array_map($func, $item) : call_user_func($callback, $item);
@eryshkov
eryshkov / xcode.dw.sh
Created October 6, 2021 20:46
xcode faster download
#!/usr/bin/env ruby
print "What is the URL of your Apple Downloads resource?\nURL:"
url = gets.strip
print "What is the ADCDownloadAuth cookie token:\nADCDownloadAuth: "
token = gets.strip
command = <<~SHELL
aria2c \
@eryshkov
eryshkov / ips.sh
Last active September 10, 2021 16:00
How to List all Docker Container Names and their IPs
docker ps -q | xargs -n 1 docker inspect --format '{{ .Name }} {{range .NetworkSettings.Networks}} {{.IPAddress}}{{end}}' | sed 's#^/##';
@eryshkov
eryshkov / mysql-docker.sh
Created April 22, 2021 07:38 — 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
@eryshkov
eryshkov / gpg.md
Created October 6, 2020 15:02 — forked from LauLaman/gpg.md
Use GPG to sign commits using git & PHPStorm

1 - install GPG tools : https://gpgtools.org/

2 - Create new key for your github email

3 - Add key to git on your local machine: git config --global user.signingkey YOURKEY

4 - configure git to sign all commits: git config --global commit.gpgsign true

5 - add to the bottom of ~/.gnupg/gpg.conf: (create the file if it not exists)

@eryshkov
eryshkov / Install
Created December 29, 2019 12:38 — forked from wastemobile/Install
LNMP, Linux(Mac) + Nginx + MySQL + PHP
安裝 Nginx, PHP-FPM, MySQL and phpMyAdmin on OS X Mavericks using Homebrew
Recently got a new MacBook Pro and decided to set it up from scratch, because I use the same Time Machine backup to migrate from since about four years. Perfect time to get rid of the web server/LAMP (Linux Apache MySQL PHP) stack and replace it with Nginx and PHP-FPM as FastCGI implementation. Below you can read how to setup Nginx, PHP-FPM, MySQL and PhpMyAdmin on OS X 10.9 / Mavericks.
Xcode
First of all, get the latest Xcode version via the Mac App Store:
Download Xcode.app (via Mac App Store)
@eryshkov
eryshkov / singletone.php
Created December 4, 2019 21:14
[Singletone]
<?php
class Singletone {
private static $instance;
private function __construct()
{
}
public static function instance() {
if (!isset(static::$instance)) {
@eryshkov
eryshkov / index.php
Last active August 23, 2019 21:56
[handleArray function] РЭЛЭКС интервью
<?php
/**
* Задание: найти в заданном массиве наибольшую по количеству элементов последовательность, в которой все элементы возрастают.
*/
function handleArray(array $array)
{
$lastKey = array_key_last($array);
$bestLength = 0;
$bestPosition = 0;
@eryshkov
eryshkov / swithes.swift
Created January 10, 2019 20:23
[Dependent switches] #UISwitch #toggle
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var sw1: UISwitch!
@IBOutlet weak var sw2: UISwitch!
override func viewDidLoad() {
super.viewDidLoad()
sw1.isOn = !sw2.isOn