Skip to content

Instantly share code, notes, and snippets.

View Exadra37's full-sized avatar

Paulo Renato Exadra37

View GitHub Profile
@Exadra37
Exadra37 / unicorn.rb
Created January 5, 2015 12:47
Fix Gitlab error 502 in order allow processing hudge differences
# by Exadra37
# this will allow gtilab to process hudge diffrences
# restart gitlab to apply changes
# change from 30 to 300
timeout 300
@Exadra37
Exadra37 / .vimrc
Last active September 18, 2015 19:43
My personnal Vim Configuration
set smartindent
set tabstop=4
set shiftwidth=4
set expandtab
set statusline="%f%m%r%h%w [%Y] [0x%02.2B]%< %F%=%4v,%4l %3p%% of %L"
nnoremap <F2> :set invpaste paste?<CR>
set pastetoggle=<F2>
set showmode
set nu
@Exadra37
Exadra37 / laravel-tips.md
Last active December 5, 2017 19:23
Laravel Tips

LARAVEL TIPS

4. Bulk Insert On Duplicate Key Update

<?php
    /**
     * When we want to perform a bulk insert we will not found support for this action in Eloquent or Query Builder
     * To avoid performance issues i have to drop my preference to be database agnostic in my Apps
     * To be used like:
     *     $table   = 'table_name';
@Exadra37
Exadra37 / debug_vars.php
Last active August 29, 2015 14:12
Debug On Screen, restricted by Ip Address, several vars at once, using var_dump() or print_r()
<?php
/**
* @author Exadra37 <exadra37atgmailpointcom>
* @since 2014/01/03
*/
if (!function_exists('debugOnScreen')) {
function debugOnScreen(array $vars, $print_r = false, $die = false)
<?php
/**
* The helper function inside section DEBUG will allow to use var_dump and print_r
* with an formatted output.
*
* The functions ddv(), ddp(), dv(), dp() will cal dump(),
* that for is turn will call isAllowedToDebug() to check if we need to check the ip address
* and in that case if the remote ip address is in the allowed ip addresses.
*
@Exadra37
Exadra37 / synchronize-prestashop-fork.sh
Created March 18, 2015 22:46
Maintain your Prestashop fork synchronized / updated with the original repository.
#!/bin/bash
# @author Exadra37 <exadra37ingmailpointcom>
# @since 2015/03/18
# @link exadra37.com
# @see Heavily inspired in http://stackoverflow.com/a/7244456
#
#
# I use this script to update my Prestashop fork when i want to make a contribution
#
@Exadra37
Exadra37 / BasicTestCase.php
Created June 4, 2015 14:11
More robust testing for the methods we are testing
<?php
/**
* @author Paulo Silva(Exadra37) <exadra37ingmaildotcom>
* @since 2015/06/04
*/
abstract class BasicTestCase extends PHPUnit_Framework_TestCase // Orchestra\Testbench\TestCase for Laravel
{
/**
@Exadra37
Exadra37 / command-line-prompt
Created June 7, 2016 13:22
Watch Mysql queries in real time
$> tail -f -n 100 /var/lib/mysql/devint1.log
...
8941 Prepare select * from `stepFeed` where `productId` = ? limit 1
8941 Execute select * from `stepFeed` where `productId` = '764773' limit 1
@Exadra37
Exadra37 / Package Control.sublime-settings
Last active April 18, 2018 11:24
Sublime Text 3 Settings - Work
{
"bootstrapped": true,
"in_process_packages":
[
],
"installed_packages":
[
"Alignment",
"Blade Snippets",
"CSS Format",
@Exadra37
Exadra37 / 00-README.md
Last active May 1, 2019 14:50
Code Snippets for an Approov Integration in Python Flask API on this blog post http://blog.approov.io/approov-integration-in-a-python-flask-api

APPROOV INTEGRATION IN A PYTHON FLASK API

The blog post can be found here.

TLDR

This walk-though will show us how simple it is to integrate Approov in a current API server using Python and the Flask framework.

We will see the requirements, dependencies and a step by step walk-through over the code necessary to implement Approov in a Python Flask API.