Categories
Git

Git got to a particular hash version

Use git checkout <sha1> to check out a particular commit.

Categories
PHPUnit

phpUnit Debug Technics Guzzle

$body = json_decode($response->getBody());

 fwrite(STDERR, json_encode($json));
 fwrite(STDERR, $body->message);
 public function testSuccesssfulJobCancel()
{

    $this->postOrderSuccesful();

    $headers = [
        'Authorization' => QATemplate::$deleteKey,
    ];
    $url = '/v1/jobId/M111111123-001';

    $response = QATemplate::$http->request(
        'DELETE',
        $url,
        [
            'verify' =>false,
            'http_errors' => false,
            'headers' =>$headers
        ]
    );

    $body = json_decode($response->getBody());

    fwrite(STDERR, json_encode($json));
    fwrite(STDERR, $body->message);


    $this->assertEquals(200, $response->getStatusCode());
    $this->assertContains("Success Job Deleted", $body->message);
}

Categories
Technical

New Keyboard Das X50Q Soft Tactile

Enjoying my new Keyboard ! Volume control is awesome !

Categories
Git

How to easily copy one git branch to another local branch ?

git checkout local-branch-i-want-to-revert
git reset --hard origin/branch-i-want-to-copy
Categories
General

DBeaver Configuration : Postgres and MacOs

1 . Install postgres

2. Find path to pg_dump

/Applications/Postgres.app/Contents/Versions/latest/bin

3. configure client (Dbeaver)

to add hidden files -> command + shift + G

paste /Applications/Postgres.app/Contents/Versions/latest/bin

and select the folder

4. Voila !

Categories
Laravel

How to Laravel Nova? Postgres

Create Resource

 php artisan nova:resource DirectMailing

Create Model

 php artisan make:model DirectMailing -m

Postgres

How to deal multiple schema ?

Connection variable is critical

protected $connection = 'pgsql-api';

How to deal with Schema and uuids ?

file location : app/LoyaltyLevels.php

class LoyaltyLevels extends Model
{
    //
    protected $connection = 'pgsql-api';
    protected $table = 'api.loyalty_levels';
    /**
     * The primary key associated with the table.
     *
     * @var string
     */
    protected $primaryKey = 'loyalty_level_uuid';
    protected $keyType = 'string';
}

File location app/Nova/LoyaltyLevels.php

 public function fields(Request $request)
    {
        return [
            Text::make('loyalty_level')->sortable(),
            Text::make('loyalty_level_description')->sortable(),
        ];
    }
Categories
Technical

SSL ImportError: No module named cryptography

Problem – Let’s Encrypt

[[email protected] ec2-user]# /usr/local/bin/certbot-auto --no-bootstrap
 Creating virtual environment…
 Installing Python packages…
 Installation succeeded.
 Traceback (most recent call last):
   File "/opt/eff.org/certbot/venv/bin/letsencrypt", line 7, in 
     from certbot.main import main
   File "/opt/eff.org/certbot/venv/local/lib/python2.7/dist-packages/certbot/main.py", line 2, in 
     from certbot._internal import main as internal_main
   File "/opt/eff.org/certbot/venv/local/lib/python2.7/dist-packages/certbot/_internal/main.py", line 10, in 
     import josepy as jose
   File "/opt/eff.org/certbot/venv/local/lib/python2.7/dist-packages/josepy/init.py", line 41, in 
     from josepy.interfaces import JSONDeSerializable
   File "/opt/eff.org/certbot/venv/local/lib/python2.7/dist-packages/josepy/interfaces.py", line 7, in 
     from josepy import errors, util
   File "/opt/eff.org/certbot/venv/local/lib/python2.7/dist-packages/josepy/util.py", line 7, in 
     import OpenSSL
   File "/opt/eff.org/certbot/venv/local/lib/python2.7/dist-packages/OpenSSL/init.py", line 8, in 
     from OpenSSL import crypto, SSL
   File "/opt/eff.org/certbot/venv/local/lib/python2.7/dist-packages/OpenSSL/crypto.py", line 12, in 
     from cryptography import x509
 ImportError: No module named cryptography

Solution

rm -rf /opt/eff.org/*
pip install -U certbot
certbot renew --debug
 certbot
Categories
Technical

How to Compress files tar bz2 ?

Compress bz2

tar -cjvf archive.tar.bz2 stuff

Decompress bz2

tar -jxvf filename.tbz2

Categories
Laravel

Laravel BackPack – Tutorial

   745  composer require backpack/crud:"4.0.*"
   746  composer require backpack/generators --dev
   747  composer require laracasts/generators --dev
   748  php artisan backpack:install
   749  php artisan make:migration:schema create_tags_table --model=0 --schema="name:string:unique"
   750  php artisan migrate
   751  php artisan backpack:crud tag
   752  valet park
   753  valet link
   754  valet links
   755  hisory
   756  history
   757  vim .env
   758  php artisan backpack:crud building
   759  php artisan backpack:crud apartment
   760  php artisan backpack:crud apartment
   

Additionnal Feature

  830  composer require backpack/permissionmanager
  831  php artisan vendor:publish --provider="Spatie\Permission\PermissionServiceProvider" --tag="migrations"
  832  php artisan migrate
  833  php artisan migrate
  834  php artisan vendor:publish --provider="Spatie\Permission\PermissionServiceProvider" --tag="config"
  835  php artisan vendor:publish --provider="Backpack\PermissionManager\PermissionManagerServiceProvider"

BackPack links

  853  php artisan backpack:add-sidebar-content "<li class='nav-item'><a class='nav-link' href='{{ backpack_url('setting') }}'><i class='nav-icon fa fa-cog'></i> <span>Settings</span></a></li>"
  854  Discovered Package: creativeorange/gravatar
  855  composer require backpack/logmanager
  856  php artisan backpack:add-sidebar-content "<li class='nav-item'><a class='nav-link' href='{{ backpack_url('log') }}'><i class='nav-icon fa fa-terminal'></i> Logs</a></li>"
  857  composer require backpack/backupmanager
  858  php artisan vendor:publish --provider="Backpack\BackupManager\BackupManagerServiceProvider"  --tag=config
  859  php artisan backpack:add-sidebar-content "<li class='nav-item'><a class='nav-link' href='{{ backpack_url('backup') }}'><i class='nav-icon fa fa-hdd-o'></i> Backups</a></li>"
  860  composer require seandowney/backpackgallerycrud
Categories
Technical

Best File compression

First, we installed Bastion and compressed its folder — about 863 MB in size of music, graphics, executable files, and various different types of documents:

  • Zip (Windows 8.1): 746 MB (86.4% of the original size)
  • Zip (WinZip): 745 MB (86.3% of the original size)
  • RAR (WinRAR): 746 MB (86.4% of the original size)
  • 7z (7-Zip): 734 MB (85% of the original size)

Next, we compressed Hotline Miami, which is 654 MB of data:

  • Zip (Windows 8.1): 316 MB (48.3% of the original size)
  • Zip (WinZip): 314 MB (48% of the original size)
  • RAR (WinRAR): 307 MB (46.9% of the original size)
  • 7z (7-Zip): 301 MB (46% of the original size)