Skip to content

Instantly share code, notes, and snippets.

View gdalmau's full-sized avatar

Gerard Dalmau gdalmau

View GitHub Profile
@gdalmau
gdalmau / brew_dependencies.md
Created August 2, 2023 10:10
Useful brew commands

brew deps

See the dependency tree for anything you installed:

> brew deps node --tree

node
├── brotli
├── c-ares
@gdalmau
gdalmau / 1-setup.md
Created April 16, 2021 08:54 — forked from troyfontaine/1-setup.md
Signing your Git Commits using GPG on MacOS Sierra/High Sierra

Methods of Signing with GPG

Last updated March 28, 2021

There are now two ways to approach this:

  1. Using gpg and generating keys
  2. Using Kryptonite by krypt.co

This Gist explains how to do this using gpg in a step-by-step fashion. Kryptonite is actually wickedly easy to use-but you will still need to follow the instructions

@gdalmau
gdalmau / .bash_prompt.sh
Last active April 15, 2021 08:00 — forked from miki725/.bash_prompt.sh
Custom bash prompt which displays: (virtualenv) user:/path (git-branch)
#!/bin/bash
#
# DESCRIPTION:
#
# Set the bash prompt according to:
# * the active virtualenv
# * the branch of the current git repository
# * the return value of the previous command
# * the fact you just came from Windows and are used to having newlines in
# your prompts.
@gdalmau
gdalmau / print_report.py
Created November 15, 2018 11:54
Imprimir report desde erppeek
import base64
import sys
import time
from subprocess import Popen
from erppeek import Client
c = Client(...
report = 'giscedata.facturacio.factura'
params = {'context': {}}
@gdalmau
gdalmau / pivotpandas.py
Last active May 2, 2018 13:01 — forked from ecarreras/pivotpandas.py
Pandas pivot table
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
# Create DataFrame from Excel
df = pd.read_excel('/home/ecarreras/Desktop/l.xls')
# Create pivot table from DataFrame
@gdalmau
gdalmau / install-postgres-10-ubuntu.md
Last active March 25, 2018 09:57 — forked from alistairewj/install-postgres-10-ubuntu.md
Install PostgreSQL 10 on Ubuntu

Install PostgreSQL 10 on Ubuntu

This is a quick guide to install PostgreSQL 10 - tested on Ubuntu 16.04 but likely can be used for Ubuntu 14.04 and 17.04 as well, with one minor modification detailed below.

(Optional) Uninstall other versions of postgres

To make life simple, remove all other versions of Postgres. Obviously not required, but again, makes life simple.

dpkg -l | grep postgres
@gdalmau
gdalmau / psql-with-gzip-cheatsheet.sh
Created February 17, 2018 10:57 — forked from brock/psql-with-gzip-cheatsheet.sh
Exporting and Importing Postgres Databases using gzip
# This is just a cheat sheet:
# On production
sudo -u postgres pg_dump database | gzip -9 > database.sql.gz
# On local
scp -C production:~/database.sql.gz
dropdb database && createdb database
gunzip < database.sql.gz | psql database
@gdalmau
gdalmau / git-squash.sh
Created January 4, 2018 16:20 — forked from favila/git-squash.sh
git-squash: script to create a squashed patch from a branch.
#! /bin/sh
# Produce a squash-commit patch from a branch of changes
MASTER=$1
PATCHBRANCH=$2
SQUASHBRANCH="$PATCHBRANCH-squash"
MESSAGE=$3
git checkout -b $SQUASHBRANCH $MASTER &&
git merge --squash $PATCHBRANCH &&
git commit -a -m "$MESSAGE" &&
@gdalmau
gdalmau / tmux-cheatsheet.markdown
Created November 27, 2017 10:26 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname