Skip to content

Instantly share code, notes, and snippets.

View mariogarcia-ar's full-sized avatar
🎯
Focusing

Mario Garcia mariogarcia-ar

🎯
Focusing
  • https://TuCuota.Online
  • Rosario, Santa Fe, Argentina
View GitHub Profile
@mariogarcia-ar
mariogarcia-ar / bearer-token.php
Created February 11, 2024 18:55 — forked from wildiney/bearer-token.php
[deprecated] PHP - How to get and set Bearer Token
<?php
/**
* ALERT! There are more than ten years since I wrote the first version (adaptation) of this code with PHP 5.6,
* then I changed my code stack and I couldn't mantain this code anymore. Ten years ago worked like a charm.
* Fell free to test, use, fork, update, etc. and if possible put in the comments how to fix,
* if it doesn't work for you as it is, so other people could find answers.
**/
/**
* Get hearder Authorization
@mariogarcia-ar
mariogarcia-ar / README.md
Created December 29, 2023 21:31 — forked from nielslange/README.md
Genesis Framework snippets

Genesis Framework snippets

Accessibility

Enable Accessibility Features

  • functions.php:
//* Enable Genesis Accessibility Components
add_theme_support( 'genesis-accessibility', array( '404-page', 'drop-down-menu', 'headings', 'rems', 'search-form', 'skip-links' ) );
@mariogarcia-ar
mariogarcia-ar / Update-branch.md
Created September 10, 2023 16:49 — forked from santisbon/Update-branch.md
Deploying from #Git branches adds flexibility. Bring your feature branch up to date with master and deploy it to make sure everything works. If everything looks good the branch can be merged. Otherwise, you can deploy your master branch to return production to its stable state.

Updating a feature branch

First we'll update your local master branch. Go to your local project and check out the branch you want to merge into (your local master branch)

$ git checkout master

Fetch the remote, bringing the branches and their commits from the remote repository. You can use the -p, --prune option to delete any remote-tracking references that no longer exist in the remote. Commits to master will be stored in a local branch, remotes/origin/master.

@mariogarcia-ar
mariogarcia-ar / imageCompression.sh
Created August 29, 2023 21:49 — forked from caubry/imageCompression.sh
Bash script using pngquant and jpegoptim library to compress PNG, JPG and JPEG, with batch compression as an option.
#!bin/bash
pwd=`pwd`
# Set the quality factor to 80
qualityCompression=80;
# Set a minimum quality factor to 20
qualityLimit=20;
# To run a new compression
second_run_compression=false;
# For batch compression
@mariogarcia-ar
mariogarcia-ar / imageresizing.php
Created August 25, 2023 07:11 — forked from georgymh/imageresizing.php
PHP Image resizing and cropping methods.
<?php
/*
Creates a thumbnail keeping the aspect ratio of the source image, and
saves it to a destination $dest.
Credits: http://davidwalsh.name/create-image-thumbnail-php
*/
function make_thumb($src, $dest, $desired_width) {
$info = getimagesize($src);
@mariogarcia-ar
mariogarcia-ar / Dockerfile
Last active March 28, 2022 23:52 — forked from julien-h2/Dockerfile
Run Ganache GUI in a docker container
FROM debian:stable-slim
RUN apt-get update
RUN apt-get install -y wget libgtk-3-dev libgtkextra-dev libgconf2-dev libnss3 libasound2 libxtst-dev libxss1 libx11-6 libx11-xcb-dev
# RUN wget https://github.com/trufflesuite/ganache/releases/download/v2.5.4/ganache-2.5.4-linux-x86_64.AppImage
RUN wget https://github.com/trufflesuite/ganache-ui/releases/download/v2.5.4/ganache-2.5.4-linux-x86_64.AppImage
RUN chmod +x ganache-2.5.4-linux-x86_64.AppImage
RUN ./ganache-2.5.4-linux-x86_64.AppImage --appimage-extract
RUN rm ganache-2.5.4-linux-x86_64.AppImage
ENV DISPLAY=host.docker.internal:0
@mariogarcia-ar
mariogarcia-ar / gist:58d073d126e4bd896ce860e4eee682b2
Created August 10, 2021 17:19 — forked from nkint/gist:8563954
ffmpeg in the shell: extracting the first frame of video
i=1
for avi in *.mp4; do
name=`echo $avi | cut -f1 -d'.'`
jpg_ext='.jpg'
echo "$i": extracting the first frame of the video "$avi" into "$name$jpg_ext"
ffmpeg -loglevel panic -i $avi -vframes 1 -f image2 "$name$jpg_ext"
i=$((i+1))
done
git clone https://github.com/vfarcic/cloud-provisioning.git
cd cloud-provisioning
scripts/dm-swarm.sh
eval $(docker-machine env swarm-1)
docker node ls
for i in 1 2 3; do
docker-machine create -d virtualbox node-$i
done
eval $(docker-machine env node-1)
docker swarm init \
--advertise-addr $(docker-machine ip node-1)
docker swarm join-token -q manager