Skip to content

Instantly share code, notes, and snippets.

View rlunaro's full-sized avatar
💭
Relaxed

Raul Luna Rodríguez rlunaro

💭
Relaxed
View GitHub Profile
@rlunaro
rlunaro / simple_log_parser.md
Created April 27, 2024 07:04
A simple log parser for apache log analysis

Simple log parser for apache

Sometimes it's useful to do it by yourself: examining the apache logs for searching certain patterns. In that ocassions, the most cumbersome thing is to start just parsing the log file. So this script comes in handy as an start thing to suit your needs and perform just the analysis you need.

So, given this log configuration:

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
@rlunaro
rlunaro / programacion_modular_c.md
Last active April 18, 2024 18:19
Básico de programación modular en C

Básico de programación modular en C

Intro

Al repartir el código en varios ficheros fuente, conseguimos estructurar nuestra aplicación en "temas": socios por un lado, cursos por otro, por ejemplo. Eso permite que la colaboración entre varias personas sea más fácil. Pero no sólo eso, facilita la mantenibilidad de la aplicación.

Y además así es como trabajan los profesionales, por todos estos motivos.

@rlunaro
rlunaro / notes-on-reactive-forms.md
Last active November 16, 2022 16:20
Notes on Reactive Forms

Configure the application to support reactive forms

In the app.module.ts, in the imports section, declare the class ReactiveFormsModule:

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [

BrowserModule,

@rlunaro
rlunaro / notes-on-validators.md
Last active October 13, 2022 11:54
Notes on Angular Validators
@rlunaro
rlunaro / formatDateUtil
Created October 4, 2022 18:05
a function that return a useful string representation of a date (like "a week ago")
/**
* Given a Date object, returns a string representing
* a "useful" translation of that date.
*
* A useful representation is "two days ago" instead of
* "18/08/2022" or "In two hours" to represent that the
* event represented by this date will begin on two hours.
*
* valores que vamos a retornar:
@rlunaro
rlunaro / notes-on-observables.md
Last active October 3, 2022 06:41
Notes on Observables

Notes on Observables

Intro

The basic pattern of the observable or observer, and has two parts:

  • The observable itself, that is, the object hat emits changes to any observer that wants to listen to it
  • The observers, objecst who get called any time the observable emits a change

Simple example

@rlunaro
rlunaro / notes-on-routes.md
Last active October 24, 2022 19:32
Some notes on angular routing

Some notes regarding Angular Routing

Navigate to a route

In the link simply add routerLink and provide the route you want to use:

    <li [routerLinkActive]="['active']"><a [routerLink]="['/recipes']" [routerLinkActive]="['navigation-bar-selected']">Recipes</a></li>

You can use routerLinkActive to set a css class to set when this route is beign used.

@rlunaro
rlunaro / Vagrantfile
Last active December 6, 2021 18:44
Vagrantfile for ubuntu 20.04 and couchdb automated install no user intervention
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "generic/ubuntu2004"
config.vm.network "forwarded_port", guest: 5984, host: 5984
config.vm.provision "shell", inline: <<-SHELL
echo "Making a backup of /etc/apt/sources.list"
@rlunaro
rlunaro / Dockercouch.sh
Created March 22, 2021 22:34
Dockerfile to create a couchdb database
#
# dockercouch.sh - helper script to manage the docker container for couch db
#
# It allows two commands: "--build" to build the container and "--run" to run the container
#
PROJECT_DIR=/YOUR-PROJECT-HERE
TAGNAME=superman_ha_muerto/couchdb
if [ "$1" != "--build" ] && [ "$1" != "--run" ]; then