Skip to content

Instantly share code, notes, and snippets.

View joseluisq's full-sized avatar

Jose Quintana joseluisq

View GitHub Profile
@joseluisq
joseluisq / export_vscode_extesions.md
Last active April 24, 2024 09:27
How to export your VS Code extensions from terminal

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 / terminal-git-branch-name.md
Last active April 20, 2024 02:26
Add Git Branch Name to Terminal Prompt (Linux/Mac)

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 / resize_disk_image.md
Last active April 16, 2024 11:18
How to resize a qcow2 disk image on Linux

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 April 16, 2024 07:06
Add two string time values (HH:mm:ss) with javascript
/**
* 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 / nginx_installation_centos.md
Created November 1, 2014 05:39
Installing Nginx in CentOS 7

Installing Nginx in CentOS 7

To install Nginx in CentOS 7, run the commands below to download and save its repository.

$ rpm -ivh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

The above commands will download and save Nginx’s repository file into the default directory at /etc/yum.repos.d/

@joseluisq
joseluisq / disable_git_gnome_ssh_askpass.md
Last active April 1, 2024 15:27
Disable Git gnome-ssh-askpass on RedHat related OS (Fedora, CentOS)

Disable Git gnome-ssh-askpass on RedHat related OS (Fedora, CentOS)

1.- Add these lines to ~/·bashrc or ~/.zshrc file :

[ -n "$SSH_CONNECTION" ] && unset SSH_ASKPASS
export GIT_ASKPASS=

2.- Update source files:

@joseluisq
joseluisq / stash_dropped.md
Last active March 28, 2024 11:59
How to recover a dropped stash in Git?

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 / xdebug_installation.md
Last active March 20, 2024 14:43
Install PHP Xdebug on Fedora / CentOS x64

PHP Xdebug installation on Fedora/CentOS x64

First, install xdebug package on system:

$ sudo yum install php-pecl-xdebug.x86_64

Or with DNF:

@joseluisq
joseluisq / README.md
Last active March 7, 2024 05:43
Install PHP 7 Xdebug in Arch Linux

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 / mysql_query_log.md
Last active March 5, 2024 10:50
How to enable the MySQL/MariaDB general query logs

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';