Skip to content

Instantly share code, notes, and snippets.

Avatar

Jose Quintana joseluisq

View GitHub Profile
@joseluisq
joseluisq / stash_dropped.md
Last active May 31, 2023 09:01
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 / README.md
Last active May 30, 2023 18:53
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 February 10, 2021 22:23 — 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 / resize_disk_image.md
Last active May 22, 2023 22:40
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 / arch_linux_icon.md
Last active May 16, 2023 20:25
How to change Gnome 3+ application grid icon with a custom Arch Linux icon
View arch_linux_icon.md

Papirus-Dark with Arch Linux Icon

How to change Gnome 3+ application grid icon with a custom Arch Linux icon

Before:

Papirus-Dark

After:

@joseluisq
joseluisq / terminal-git-branch-name.md
Last active May 16, 2023 17:10
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 / export_vscode_extesions.md
Last active May 15, 2023 04:07
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
View go_snnipts.json
{
// Place your snippets for go here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
// "Print to console": {
// "prefix": "log",
// "body": [
// "console.log('$1');",
@joseluisq
joseluisq / mysql_query_log.md
Last active April 21, 2023 13:51
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 / database.module.ts
Last active April 18, 2023 07:40
Nest Database Module (Type ORM) with environment variables support
View database.module.ts
import { Module, Global, DynamicModule } from '@nestjs/common'
import { EnvModule } from './env.module'
import { EnvService } from './env.service'
import { TypeOrmModule } from '@nestjs/typeorm'
function DatabaseOrmModule (): DynamicModule {
const config = new EnvService().read()
return TypeOrmModule.forRoot({
type: config.DB_TYPE,