Skip to content

Instantly share code, notes, and snippets.

Avatar
🌄
Trying to help the World

Lucas M. Dutra terremoth

🌄
Trying to help the World
  • Imaginum Softworks
  • Florianópolis, SC - Brazil
View GitHub Profile
@terremoth
terremoth / reconfigure-phpini.sh
Last active Oct 20, 2021
Change and Reconfigure PHP ini (from FPM) via shellscript
View reconfigure-phpini.sh
#!/usr/bin/env sh
# The FPM ini file, and not the CLI one
ini_file=$(php -i | grep "Loaded Configuration File" | awk -F ' => ' '{print $2}' | sed 's/cli/fpm/g')
echo $ini_file
sudo sed -i 's/memory_limit\s*=.*/memory_limit = 256M/g' $ini_file
cat $ini_file | grep memory_limit
sudo sed -i 's/upload_max_filesize\s*=.*/upload_max_filesize = 3G/g' $ini_file
@terremoth
terremoth / bhutti_challenge.php
Last active Apr 21, 2021
Challenge from BHUT TI as a "FizzBuzz" similar
View bhutti_challenge.php
<?php
declare(strict_types=1);
/*
* coded by Lucas M. Dutra, github.com/terremoth
*/
abstract class Modulize
{
@terremoth
terremoth / count_chars.php
Last active Dec 17, 2018
Count repeated chars sequence and build a string with its chars (only 1) + repeated numbers
View count_chars.php
<?php
$input = 'aaacccbdd';
$output = 'a3b1c3d2';
$list = str_split($input);
$matchs = [];
foreach ($list as $i => $char) {
isset($matchs[$char]) ? $matchs[$char]++ : $matchs[$char] = 1;
@terremoth
terremoth / Car.php
Last active Apr 5, 2018
Answering question in "Desenvolvimento Web" facebook group
View Car.php
<?php
class Car
{
// As variáveis da classe são propriedades do objeto "Car"
private $name; // isto é uma propriedade
protected $color; // isto também é
public $brand; // e isto também é
@terremoth
terremoth / HttpRequest.php
Last active Dec 17, 2018
Curl Request WS API
View HttpRequest.php
<?php
class HttpRequest
{
protected $url;
protected $headers = array();
public $httpCode;
private $sslVerify = false;
public function request($data, $rawMethod = 'POST', $sendMode = 'json')
@terremoth
terremoth / compras.class.php
Created May 21, 2017
Exemplo de lista de compras para discussão thread safe, parallel programming
View compras.class.php
<?php
Class Compras
{
private $lista = array();
public add($item)
{
$this->lista[] = $item;
}