Skip to content

Instantly share code, notes, and snippets.

View Carleslc's full-sized avatar

Carlos Lázaro Costa Carleslc

View GitHub Profile
@Carleslc
Carleslc / passwordGenerator.lua
Last active October 5, 2018 23:21
SimplePasswordGenerator created by Carleslc - https://repl.it/@Carleslc/SimplePasswordGenerator
function randPW(length, strong)
local index, pw, rnd = 0, ""
local chars = {
"ABCDEFGHIJKLMNPQRSTUVWXYZ", -- O
"abcdefghijklmnopqrstuvwxyz",
"123456789" -- 0
}
if strong then
table.insert(chars, "!\\#$%&()*+,-./:;<=>?@[]^_{|}~") -- '"
end
@Carleslc
Carleslc / gitc
Last active May 13, 2019 16:55
Git utility for grouping pull/status & add/commit/push
#!/bin/bash
set -e
if [ "$1" == "-h" ]; then
echo "Pull & Status with: gitc"
echo "Stage and commit all changes with: gitc MESSAGE"
elif [ "$1" != "" ]; then
git pull --all
git add -A
git commit -m "$*"
git push --all
@Carleslc
Carleslc / paypal-donation
Created May 13, 2019 18:19
PayPal Donation with Item Name
https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=carlos.lazaro.costa@gmail.com&currency_code=EUR&amount=29.99&&item_name=Test
@Carleslc
Carleslc / factorial.kt
Created March 15, 2018 03:56
Factorial in Kotlin
/** If high-performance is needed consider using Guava BigIntegerMath.factorial instead **/
fun Long.factorial(): BigInteger {
fun factorial(start: Long, n: Long): BigInteger {
var i: Long
if (n <= 16) {
var r = BigInteger.valueOf(start)
i = start + 1
while (i < start + n) {
r = r.multiply(BigInteger.valueOf(i))
i++
@Carleslc
Carleslc / n-queens-permutations.py
Last active April 30, 2020 08:09
N queens problem solver (brute-force permutations)
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# N queens problem
# https://en.wikipedia.org/wiki/Eight_queens_puzzle
# usage: n-queens-permutations.py [-h] [--n N] [--verbose] [--count-only] [--first]
# [--solution SOLUTION]
# optional arguments:
@Carleslc
Carleslc / virtualenv.sh
Created July 1, 2020 13:42
Install and activate Python environment with virtualenv
sudo pip install virtualenv
virtualenv env
. env/bin/activate # Bash/Tcsh console
#. env/bin/activate.fish # Fish console
@Carleslc
Carleslc / redirect.html
Last active July 14, 2020 20:30
Redirect Page
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Redirecting...</title>
<!-- Redirect -->
@Carleslc
Carleslc / thank-you.html
Created July 14, 2020 20:31
Thank You Page
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Recurso a&ntilde;adido</title>
<!-- Style -->
@Carleslc
Carleslc / iframe.html
Created July 14, 2020 20:34
Full Page Iframe Embed
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Full Page Iframe Embed</title>
<!-- Style -->
@Carleslc
Carleslc / knight-tour-8.py
Last active August 4, 2020 01:24
Solve Knight's Tour problem graphically step by step using Warndsdorff's rule on a classic chess board
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# KNIGHT'S TOUR PROBLEM
# https://en.wikipedia.org/wiki/Knight%27s_tour
# This program solves the problem using Warndsdorff's rule for a 8x8 board
# Further investigation: https://github.com/douglassquirrel/warnsdorff/blob/master/5_Squirrel96.pdf?raw=true