Skip to content

Instantly share code, notes, and snippets.

View malkab's full-sized avatar

Juan Pedro Pérez Alcántara malkab

  • Sunntics Ltd.
  • Seville, Andalusia (Spain)
View GitHub Profile
@malkab
malkab / docker-basic_node_run.sh
Last active July 23, 2022 14:35
Docker - Basic Node Run
#!/bin/bash
# -----------------------------------------------------------------
#
# Runs an interactive Node container.
#
# -----------------------------------------------------------------
docker run -ti --rm \
--name libwk32_node_dev \
--hostname libwk32_node_dev \
@malkab
malkab / grass_docker_examples.sh
Last active June 23, 2022 11:41
GRASS Docker Examples
#!/bin/bash
# -----------------
#
# The GRASS Docker image is the main geo processing hub. It contains
# GDAL, GRASS, PostgreSQL for interfacing with PostGIS containers,
# Python, Node, etc.
#
# -----------------
@malkab
malkab / docker_repositories.sh
Created May 16, 2022 11:11
Docker Repositorios
# How to log in Docker repositories
# Log into DockerHub repository (default)
# Private repositories at DockerHub must be created manually beforehand
# and set to private
docker login -u USERNAME -p PASSWORD
# Log into GitLab repository
docker login -u USERNAME -p PASSWORD <registry URL>/<namespace>/<project>/<image>
@malkab
malkab / rsync_examples.sh
Last active May 18, 2022 14:54
rsync examples
#!/bin/bash
# Get all *.tar files from the remote server app folder, without recursing into folders
rsync -avh --progress --rsh="ssh -i aws-pem" \
user@host:/path/to/folder/*.tar ~/Desktop
# Complete with exclude and mlkctxt
@malkab
malkab / rxjs_subjects.ts
Last active April 26, 2022 10:20
RxJS - Subjects
import * as rx from "rxjs";
/**
Define a class with a Subject$.
*/
class A {
/**
@malkab
malkab / cli_json_manipulation_jq.sh
Created April 20, 2022 09:46
CLI JSON Manipulation - jq
#!/bin/bash
# Color output
jq --color-output . file.json
# Pretty
jq '.' non-pretty.json > pretty.json
@malkab
malkab / visual_studio_code_linux_configuration_key_bindings.md
Last active July 21, 2022 15:13
Visual Studio Code: Configuration & Key Bindings

Visual Studio Code - Linux Key Bindings

Key:

  • C: Control
  • S: Shift

Environment Navigation Shortcuts

| Action | Key |

@malkab
malkab / complex_template.yml
Created April 13, 2022 22:12
tmuxinator Templates
name: sunnsaas_v1-full_backend
root: /home/git/sunnsaas/sunnsaas_v1
startup_window: sunnsaas_v1-full_backend/full_backend
# This shows a custom layout obtained with PREFIX : list-windows after configuring it with PREFIX : resize-pane
# Predefined layouts are: even-horizontal, even-vertical, main-horizontal, main-vertical, and tiled.
windows:
- sunnsaas_v1-full_backend/full_backend:
layout: 935c,317x73,0,0{210x73,0,0[210x36,0,0,0,210x36,0,37,4],106x73,211,0[106x18,211,0,1,106x17,211,19,5,106x18,211,37,2,106x17,211,56,3]}
@malkab
malkab / python_json_etl.py
Created April 13, 2022 11:27
Python - JSON ETL
# -------------------------
#
# Reads JSON from file, process it, and save results
#
# -------------------------
import json
wpBaseFolder = "workpackages/wp-2022-04-13-010-process-heliostat_fields/src"
with open("%s/data/000_in/Hel_Eff_param.json" % wpBaseFolder) as f:
@malkab
malkab / typescript-cli_interfaces.ts
Created April 11, 2022 21:03
TypeScript - Defining command line script interfaces (CLI)
import { Command } from "commander"
/**
The CLI interface is defined using the commander.js library.
*/
// Main object
const program = new Command();