This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby -wU | |
# juanfc 2024-03-16 | |
# https://gist.github.com/juanfal/39206b7d47a1eacac35cbd1b98f6f5d3 | |
if ARGV.length < 1 or (ARGV.length == 1 and ARGV[0] == '-h') then | |
puts "Usage: | |
#$0 [destdmg] sourceFolder [sourceFolders..] | |
" | |
exit 0 | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# myip | |
# juanfc 2024-01-11 | |
# wget http://ipinfo.io/ip -qO - | |
# ipconfig getifaddr en0 2>/dev/null || ipconfig getifaddr en1 2>/dev/null | |
# dig +short myip.opendns.com @208.67.222.222 | |
# dig +short myip.opendns.com @resolver1.opendns.com | |
# ipconfig getifaddr en0 2>/dev/null || ipconfig getifaddr en1 2>/dev/null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// x3.mbiggest.cpp | |
// juanfc 2024-01-08 | |
// Without open array | |
// | |
#include <iostream> | |
#include <array> | |
using namespace std; | |
const int MAXDIFNUMS = 50; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// x2.maxdistrepwords.cpp | |
// juanfc 2024-01-08 | |
// | |
// The \textbf{distance between two words} in a text is the number of words in | |
// between them. Build an algorithm that reads from keyboard a sequence of words | |
// and then print on the screen the maximum distance between repeated words. | |
// Words that are no repeated will not appear in the output. | |
#include <iostream> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// x1.words.cpp | |
// juanfc 2024-01-08 | |
// | |
#include <iostream> | |
#include <array> | |
using namespace std; | |
const int MAX_DIFF_WORDS = 1000; | |
const int MAX_REP = 1000; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// t13e18.GameOfLife.cpp | |
// juanfc 2023-12-11 | |
// https://gist.github.com/juanfal/14e0ffcb4439a5544a9c08768b6b3a99 | |
// | |
// Three rules: | |
// INITIAL STATE -> FINAL STATE | |
// dead with 3 -> alive | |
// alive with 2 or 3 -> alive | |
// else -> dead | |
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// p7e02.words.cpp | |
// juanfc 2023-11-24 | |
// https://gist.github.com/juanfal/f13931517b6599093996884314d010cc | |
#include <iostream> | |
#include <array> | |
using namespace std; | |
const int N = 100; | |
typedef array<string,N> TListWords; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// t13e18.4inrow.cpp | |
// juanfc 2023-11-09 | |
// | |
#include <iostream> | |
#include <array> | |
using namespace std; | |
const int COLS = 7; | |
const int ROWS = 6; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// t13e11.maxDiag.cpp | |
// juanfc 2023-11-23 | |
// Find the greatest sum for the elements of all the pos- sible diagonals of a | |
// TMat. Take into account that diagonals can go ↘ or ↗. Some diagonals are | |
// shorter than others. | |
// | |
#include <iostream> | |
#include <iomanip> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// t11e10.isograms.cpp | |
// juanfc 2023-11-22 | |
// https://gist.github.com/juanfal/1b181c7c25d6af7288678d09a6c5ccae | |
#include <iostream> | |
#include <array> | |
using namespace std; | |
typedef array<int,256> TCharFreq; |
NewerOlder