Skip to content

Instantly share code, notes, and snippets.

Avatar
🦀

Jose Quintana joseluisq

🦀
View GitHub Profile
@joseluisq
joseluisq / stash_dropped.md
Last active Jan 28, 2023
How to recover a dropped stash in Git?
View stash_dropped.md

How to recover a dropped stash in Git?

1. Find the stash commits

git log --graph --oneline --decorate ( git fsck --no-reflog | awk '/dangling commit/ {print $3}' )

This will show you all the commits at the tips of your commit graph which are no longer referenced from any branch or tag – every lost commit, including every stash commit you’ve ever created, will be somewhere in that graph.

@joseluisq
joseluisq / mysql_query_log.md
Last active Jan 26, 2023
How to enable the MySQL/MariaDB general query logs
View mysql_query_log.md

How to enable the MySQL/MariaDB general query logs

  1. Enter to MySQL/MariaDB server command-line tool (change root with your username and password):
mysql -u root -proot
  1. Set the general log file path:
SET GLOBAL general_log_file='/var/log/mysql/mycustom.log';
@joseluisq
joseluisq / resize_disk_image.md
Last active Jan 20, 2023
How to resize a qcow2 disk image on Linux
View resize_disk_image.md

How to resize a qcow2 disk image on Linux

This example takes olddisk.qcow2 and resizes it into newdisk.qcow2, extending one of the guest's partitions to fill the extra space.

1. qcow2 format

1.1. Verify the filesystems of olddisk.qcow2

@joseluisq
joseluisq / add_two_times.js
Last active Jan 17, 2023
Add two string time values (HH:mm:ss) with javascript
View add_two_times.js
/**
* Add two string time values (HH:mm:ss) with javascript
*
* Usage:
* > addTimes('04:20:10', '21:15:10');
* > "25:35:20"
* > addTimes('04:35:10', '21:35:10');
* > "26:10:20"
* > addTimes('30:59', '17:10');
* > "48:09:00"
@joseluisq
joseluisq / 1README.md
Created Apr 19, 2017
How add a custom field to Laravel 5.4 default login. LoginController.php
View 1README.md

How add a custom field to Laravel 5.4 default login controller.

In this php example (app/Http/Controllers/Auth/LoginController.php) my model is called Client and the custom field for login validation is status. (Client->status)

Add in your resources/lang/en/auth.php file :

    'failed_status' => 'Your account is inactive yet. Please confirm your e-mail address.',
@joseluisq
joseluisq / terminal-git-branch-name.md
Last active Jan 6, 2023
Add Git Branch Name to Terminal Prompt (Linux/Mac)
View terminal-git-branch-name.md

Add Git Branch Name to Terminal Prompt (Linux/Mac)

image

Open ~/.bash_profile in your favorite editor and add the following content to the bottom.

# Git branch in prompt.

parse_git_branch() {
@joseluisq
joseluisq / README.md
Last active Dec 20, 2022
Install PHP 7 Xdebug in Arch Linux
View README.md

Install PHP 7 Xdebug in Arch Linux

"Normally", these instructions should be also valid (in similar way) for other Linux distros.

1.- Install Xdebug using pacman:

sudo pacman -Sy xdebug
@joseluisq
joseluisq / main.rs
Created Feb 10, 2021 — forked from lu4nm3/main.rs
Tokio Async: Concurrent vs Parallel
View main.rs
use futures::StreamExt;
use std::error::Error;
use tokio;
use tokio::macros::support::Pin;
use tokio::prelude::*;
use tokio::time::{Duration, Instant};
pub fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut multi_threaded_runtime = tokio::runtime::Builder::new()
.threaded_scheduler()
@joseluisq
joseluisq / export_vscode_extesions.md
Last active Dec 6, 2022
How to export your VS Code extensions from terminal
View export_vscode_extesions.md

How to export your VS Code extensions from terminal

Note: Unix-like systems only.

  1. Export your extensions to a shell file:
code --list-extensions | sed -e 's/^/code --install-extension /' > my_vscode_extensions.sh
@joseluisq
joseluisq / currencies.json
Created Apr 3, 2018
JSON list of all currency symbols available from the Open Exchange Rates API - https://docs.openexchangerates.org/docs/currencies-json
View currencies.json
{
"AED": "United Arab Emirates Dirham",
"AFN": "Afghan Afghani",
"ALL": "Albanian Lek",
"AMD": "Armenian Dram",
"ANG": "Netherlands Antillean Guilder",
"AOA": "Angolan Kwanza",
"ARS": "Argentine Peso",
"AUD": "Australian Dollar",
"AWG": "Aruban Florin",