Skip to content

Instantly share code, notes, and snippets.

View llekn's full-sized avatar
🎯
Focusing

Camilo Flores llekn

🎯
Focusing
View GitHub Profile
@llekn
llekn / http-stdout-echo.py
Last active January 7, 2024 23:35
HTTP server that print what is requested to console. Useful for debugging purposes.
#!/usr/bin/env python3
'''Usage:
python3 http-stdout-echo.py -a <bind-address> -p <bind-port>
Examples:
python3 http-stdout-echo.py # (will listen at 127.0.0.1:8080 by default)
python3 http-stdout-echo.py -a 10.3.1.3 -p 5555'''
from http.server import HTTPServer, BaseHTTPRequestHandler
@llekn
llekn / wave_sort.md
Last active October 5, 2023 19:00
Wave Sort

Wave Sort

Dado un arreglo de números (por ejemplo [1, 2, 6, 19, 12, 3, 1]), crear la función wave_sort que ordene los elementos del arreglo "como serrucho". Esto es, el arreglo retornado debe cumplir con el siguiente criterio:

arr[0] >= arr[1] <= arr[2] >= arr[3] <= arr[4] >= ...

Una posible solución, para el caso del ejemplo es:

@llekn
llekn / .overcommit.yml
Last active July 29, 2022 10:32 — forked from gmq/.overcommit.yml
Overcommit configuration for rails/es6 projects
# Use this file to configure the Overcommit hooks you wish to use. This will
# extend the default configuration defined in:
# https://github.com/brigade/overcommit/blob/master/config/default.yml
#
# At the topmost level of this YAML file is a key representing type of hook
# being run (e.g. pre-commit, commit-msg, etc.). Within each type you can
# customize each hook, such as whether to only run it on certain files (via
# `include`), whether to only display output if it fails (via `quiet`), etc.
#
# For a complete list of hooks, see:
@llekn
llekn / .pryrc
Created May 25, 2022 16:42
Pry configuration for integration with vscode and sublime
Pry::Commands.block_command('enable-pry', 'Enable `binding.pry` feature') do
ENV['DISABLE_PRY'] = nil
end
# Sublime
# Pry.config.editor = -> (file, line) { line == 0 ? "subl #{file}" : "subl #{file}:#{line}" }
# VSCode
Pry.config.editor = ->(file, line) { "code --goto #{file}:#{line} --wait" }
UPDATE accounts SET balance = balance + 100.00 WHERE name = 'Bob';
UPDATE accounts SET balance = balance - 100.00 WHERE name = 'Alice';
@llekn
llekn / overcommit.md
Created June 9, 2017 21:02
Overcommit overview

Overcommit

Overview

Overcommit is a gem that makes easy to add, configure and run tasks on git hooks (script that are run when manipulating a git repo, for example, before making a commit).

Setup

  1. Add the gem overcommit to development environment, or install it globally on you machine with gem install overcommit
  2. On the project on which you want to use overcommit, install the git hooks provided by overcommit: overcommit --install
@llekn
llekn / run-debian.sh
Created January 2, 2020 02:48
Script to run debian live on macos
#!/bin/bash
# Run Debian live on macos using hw acceleration
qemu-system-x86_64 \
-m 512 -vga std -accel hvf -smp 2 -cpu host \
debian-live-10.1.0-amd64-gnome.iso \
-device nec-usb-xhci,id=xhci \
-device usb-host,vendorid=0x054c,productid=0x09c3 \
@llekn
llekn / sprint_ritual.md
Last active August 9, 2019 16:19
Metodología de sprint acumulada

Sprint

Revisar qué hemos terminado

  • Revisar columna "Listo"
  • Revisar columna "En producción"
  • Mover tarjetas que estén OK de "En producción" a "Listo"
  • Archivar tarjetas columna "Listo"
  • Mover tarjetas que no estén ok de "En producción" a "Backlog"

Keybase proof

I hereby claim:

  • I am llekn on github.
  • I am llekn (https://keybase.io/llekn) on keybase.
  • I have a public key ASDd9gnza_r1_3CgJE5Sl8ISTG0jJYfCFmTjzhL38bckjQo

To claim this, I am signing this object:

@llekn
llekn / app.reducer.ts
Created August 3, 2018 15:59
Binding NgRx store with Ionic navigation!
const actionMap: any = {
[gateAccess.REWIND_REGISTRATION]: (state, action) => {
switch (state.step) {
case 'vehicle':
return resetState(state);
case 'driver':
return updateObject(state, { lastAccess: null, step: 'vehicle' });
case 'confirmation':
return updateObject(state, {
lastAccess: null,