Skip to content

Instantly share code, notes, and snippets.

View madeinnordeste's full-sized avatar
:octocat:
Coding

Luiz Alberto S. Ribeiro madeinnordeste

:octocat:
Coding
View GitHub Profile
@madeinnordeste
madeinnordeste / update-email-name-multiples-commits.sh
Created March 25, 2024 21:04
Change the author and committer name/email for multiple commits
#!/bin/sh
# https://stackoverflow.com/questions/750172/how-do-i-change-the-author-and-committer-name-email-for-multiple-commits
git filter-branch --env-filter '
OLD_EMAIL="your-old-email@example.com"
CORRECT_NAME="Your Correct Name"
CORRECT_EMAIL="your-correct-email@example.com"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
@madeinnordeste
madeinnordeste / events.json
Created January 23, 2024 12:32
random calendar events
This file has been truncated, but you can view the full file.
[
{
"kind": "brand event",
"etag": "\"9798284412176\"",
"id": "9486a51e-b34d-3965-8f8c-30ed0919d893",
"status": "not confirmed",
"htmlLink": "http:\/\/schowalter.info\/",
"created": "2025-01-02T05:51:35.259Z",
"updated": "2025-01-02T05:51:35.259Z",
"summary": "Et est aperiam harum saepe vel necessitatibus.",
@madeinnordeste
madeinnordeste / via-cep.php
Created November 22, 2023 19:23
via cep api
public function consultZip($zip)
{
$client = new Client(["http://viacep.com.br/ws/" . $zip . "/json/"]);
$result = $client->request('get', "http://viacep.com.br/ws/" . $zip . "/json/", ['Accept' => 'application/json']);
$output = $result->getBody()->getContents();
return $output;
}
@madeinnordeste
madeinnordeste / Three-Little-Birds.php
Last active November 8, 2023 21:56
Three-Little-Birds.php
<?php
if(!$worry){
foreach($things as $little_thing){
$little_thing->all_right();
}
}
@madeinnordeste
madeinnordeste / PHP-Remove-URL-from-string.php
Created May 3, 2014 00:56
PHP - Remove URLs from string
<?php
$string = 'Hi, visit my website: http://beto.euqueroserummacaco.com';
$string = preg_replace('/\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|$!:,.;]*[A-Z0-9+&@#\/%=~_|$]/i', '', $string);
echo $string;
?>
@madeinnordeste
madeinnordeste / PHP-Get-Geocode-from-Address
Last active October 4, 2022 13:30
PHP - Get Geocode (lat, long) from Address
<?php
$address = 'avenida+gustavo+paiva,maceio,alagoas,brasil';
$geocode = file_get_contents('http://maps.google.com/maps/api/geocode/json?address='.$address.'&sensor=false');
$output= json_decode($geocode);
$lat = $output->results[0]->geometry->location->lat;
$long = $output->results[0]->geometry->location->lng;
@madeinnordeste
madeinnordeste / PHP-Text-URL-to-Hyperlink.php
Last active April 27, 2022 20:08
PHP - Transform text URL to Hyperlink
@madeinnordeste
madeinnordeste / PHP-script-tags-to-bottom.php
Created May 3, 2014 01:02
PHP - Move Script TAGS to bottom
<?php
$source = file_get_contents("http://www.mywebsite.com");
preg_match_all("/<script(.|\n)*?<\/script>/", $source, $matches);
$source = preg_replace("/<script(.|\n)*?<\/script>/", '', $source);
$scripts = implode('', $matches[0]);
# kill containers
function docker-kill-containers(){
docker kill $(docker ps -q)
}
# remove stoped containers
function docker-remove-containers(){
docker rm $(docker ps -a -q)
}
@madeinnordeste
madeinnordeste / base64encode.sh
Created July 26, 2020 20:51
Base 64 encode file in one line
# encode
cat key.txt | base64 -w0
# decode
cat stribng | base64 --decode