Skip to content

Instantly share code, notes, and snippets.

View mbdaso's full-sized avatar
🎯
Focusing

Martín mbdaso

🎯
Focusing
View GitHub Profile

Just go to the folder where your YAML file is and run docker-compose up -d

@mbdaso
mbdaso / mergesort.cs
Last active September 2, 2022 14:36
Merge sort
// Merge two sorted halves
void merge(ref int[] a, int start, int mid, int end){
int p = start, q = mid+1, k = 0; // p = first half index, q = second half index, k = index of s
int[] s = new int [end-start+1]; // create auxiliary array with the same size of a
while(k <= end - start){ // both halves of a[] are sorted and have to be sorted again in a whole new array
if (p > mid)
s[k++] = a[q++]; // abbreviation for s[k] = a[q]; k++; q++;
else if(q > end)
s[k++] = a[p++];
else if(a[p] < a[q])
@mbdaso
mbdaso / apihelper.py
Created May 27, 2019 11:37
Info sobre objetos python
def info(object, spacing=10, collapse=1):
"""Print methods and doc strings.
Takes module, class, list, dictionary, or string."""
methodList = [method for method in dir(object) if callable(getattr(object, method))]
processFunc = collapse and (lambda s: " ".join(s.split())) or (lambda s: s)
print "\n".join(["%s %s" %
(method.ljust(spacing),
processFunc(str(getattr(object, method).__doc__)))
for method in methodList])
@mbdaso
mbdaso / bcolors.py
Created May 27, 2019 11:36
Mensajes de colores en python
class bcolors:
HEADER = '\033[95m'
BLUE = '\033[94m'
GREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
GREENB = GREEN + BOLD
@mbdaso
mbdaso / redimensionar.md
Created May 10, 2019 09:22
Redimensionar particiones LVM desde linea de comandos

Para redimensinoar

  1. dmesg -> mirar letra de dispositivo
  2. Formatear disco
fdisk /dev/sdb (crear nueva partición con todo)
  1. Ver vg disponibles
vgs