Skip to content

Instantly share code, notes, and snippets.

View Cs4r's full-sized avatar

César Aguilera Cs4r

  • Málaga, Spain
View GitHub Profile
@Cs4r
Cs4r / gist:3996561
Created November 1, 2012 21:09
Sudoku en Python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# sudoku.py
#
# Escrito por César Aguilera http://cosmobitsion.blogspot.com/
#
# REQUISITOS: Para ejecutar este programa deberá descargar el
# generador sudokus de David Bau a través de la dirección web:
# http://davidbau.com/downloads/sudoku.py y renombrarlo a
@Cs4r
Cs4r / localstack.md
Last active May 21, 2021 16:49 — forked from lobster1234/localstack.md
Working with localstack on command line

Starting localstack

C02STG51GTFM:localstack mpandit$ make infra
. .venv/bin/activate; exec localstack/mock/infra.py
Starting local dev environment. CTRL-C to quit.
Starting local Elasticsearch (port 4571)...
Starting mock ES service (port 4578)...
Starting mock S3 server (port 4572)...
Starting mock SNS server (port 4575)...
@Cs4r
Cs4r / clean_code.md
Created June 2, 2017 09:37 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@Cs4r
Cs4r / .cvim
Last active March 9, 2017 23:42
my cVim settings
set nohud
set nosmoothscroll
set noautofocus
" Code blocks (see below for more info)
getIP() -> {{
httpRequest({url: 'http://api.ipify.org/?format=json', json: true},
function(res) { Status.setMessage('IP: ' + res.ip); });
}}
" Displays your public IP address in the status bar
@Cs4r
Cs4r / gist:e55bf303d62aa2a4fca2c1a40cfe7b00
Created April 2, 2016 11:20
Create a source from a collection with akka-streams
final Source<Integer, NotUsed> sourceOfNumbers = Source.from(
Arrays.asList(1,2,3)
);
@Cs4r
Cs4r / Test.java
Created November 6, 2012 19:37
Programa para testear y medir tiempos en el Algoritmo de resolucion de sudokus hexadecimales
//import java.io.BufferedWriter;
//import java.io.FileWriter;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
@Cs4r
Cs4r / gist:3996566
Created November 1, 2012 21:10
Sudoku Backtracking en Perl
#!/usr/bin/env perl
#
# bksudoku.pl
#
# Escrito por César Aguilera http://cosmobitsion.blogspot.com/
#
# Este programa es software libre, usted puede redistribuirlo y/o
# modificarlo bajo los términos de la GNU General Public License
# publicada por la Free Software Foundation, bien de la versión 2
# de la Licencia o cualquier versión posterior.
@Cs4r
Cs4r / my_pow.py
Created January 8, 2012 11:03
An elegant way to calculate a^n with positive integer values. O(log(n))
def my_pow(a,n):
"""Returns base raised to the power exponent."""
if n == 1:
return a
u = my_pow(a,n/2)
return a*u*u if n&1 else u*u