Skip to content

Instantly share code, notes, and snippets.

View shov's full-sized avatar
🐊
^^

Alexander Shevchenko shov

🐊
^^
View GitHub Profile
@shov
shov / Dockerfile
Created May 21, 2018 09:36
Docker PHP 7.2 fpm with GD jpg, png suppot
FROM php:7.2-fpm
# Replace shell with bash so we can source files
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
# make sure apt is up to date
RUN apt-get update --fix-missing
RUN apt-get install -y curl
RUN apt-get install -y build-essential libssl-dev zlib1g-dev libpng-dev libjpeg-dev libfreetype6-dev
@shov
shov / Dockerfile-part
Created May 12, 2018 12:23
Laradock dockerfile parts for php-fpm and workspace to install zeroMQ zmq
##PHP-FPM
RUN apt-get update -yqq && \
apt-get install -y build-essential libtool autoconf pkg-config libsodium-dev libzmq-dev && \
echo '' | pecl install -o -f zmq-beta && rm -rf /tmp/pear && \
echo "extension=zmq.so" > /usr/local/etc/php/conf.d/zmq.ini \
##WORCKSPACE
RUN apt-get update -yqq && \
apt-get install -y build-essential libtool autoconf pkg-config libsodium-dev libzmq-dev && \
echo '' | pecl install -o -f zmq-beta && rm -rf /tmp/pear && \
@shov
shov / fetchtransactionsbywallet.md
Last active September 6, 2023 04:11
Etherscan public API to fetch transactions by wallet

Etherscan public API

Overview

There is no documentation at the moment, but there are some rumors. And experemental way I've made sure about few end-points are working good:

Common account info

GET: https://www.etherchain.org/api/account/0xAAAsomeADDR00000000000/ Will return something like that:

{
@shov
shov / TestHelperTrait.php
Created February 26, 2018 08:54
Laravel test migration and seeding helper
<?php declare(strict_types=1);
namespace Tests\Feature;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Contracts\Console\Kernel;
/**
* Some functionality for TestCases
*
@shov
shov / AllowCrossOrigin.php
Last active February 8, 2024 18:29
Laravel middleware to Allow Cross Origin CORS
<?php
namespace App\Http\Middleware;
use Closure;
use Symfony\Component\HttpFoundation\Response;
/**
* The after middleware to allow specific Access-Control-Allow-Origin
*/
@shov
shov / .env
Created January 29, 2018 14:56
Unit test Laravel 5 packages in context with Travis CI (with MySQL testing database)
APP_ENV=testing
APP_DEBUG=true
APP_KEY=RMme3vqJUaNAxVi5kq33xBgRAxmp7yXU
DB_HOST=localhost
DB_DATABASE=test
DB_USERNAME=root
DB_PASSWORD=
CACHE_DRIVER=array
@shov
shov / DecoratorWithStatic.php
Last active February 16, 2018 11:00
PHP Decorator trait. For a while not correct (catch any throwable and means it's error of calling undefined static method
/**
* Trait DecoratorTrait
*
* Have to implemented:
* @method getDecoratedObject()
* @static $decoratedClass
*/
trait DecoratorTrait
{
/**
@shov
shov / Decorator.php
Last active December 7, 2017 09:19
PHP Implementation of the decorator as the Trait
<?php
/**
* Trait Decorator
*
* Required on host
* @method getDecoratedObject()
*/
trait Decorator
{
@shov
shov / biggest10DirFile.sh
Created June 5, 2017 08:29
Looking for 10 biggest dir and file
#!/bin/bash
echo "Dirs"
du -hsx * | sort -rh | head -10
echo "Files"
find . -type f -printf '%s %p\n'| sort -nr | head -10
@shov
shov / removeCR.sh
Last active May 18, 2017 09:28
Remove \r in all .sh in the current directory used tr
#!/bin/bash
function movement() {
local bname=$(basename "$1")
local fbname=${bname%.*}
mv "$1" "${fbname}"
}
find . -name '*.sh' -exec sh -c 'tr -d "\r" < "$0" > "$0.tmp"' '{}' \;
find . -name "*.sh.tmp" | while read file; do movement "$file"; done