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
-- | |
-- Convert to decimal and change luminosity | |
-- Inspired by: http://www.sitepoint.com/javascript-generate-lighter-darker-color/ | |
-- | |
-- | |
-- Reverse: to_hex | |
-- See: http://grokbase.com/t/postgresql/pgsql-general/0541qyk9ya/help-with-converting-hexadecimal-to-decimal | |
CREATE OR REPLACE FUNCTION from_hex(t text) RETURNS integer AS $$ | |
DECLARE |
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
/** | |
* Conway Sequence | |
* | |
* @see http://en.wikipedia.org/wiki/Look-and-say_sequence | |
* @author Thiago Prates | |
*/ | |
public class ConwaySequence { | |
/** | |
* Generate a element at position n according to *Conway Sequence*. |
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
/** | |
* HmacSHA512 | |
* | |
* @see <http://drumcoder.co.uk/blog/2011/apr/21/calculate-hmac-hash-java/> | |
* @param String value | |
* @param String secret | |
* @return String | |
*/ | |
private String buildHmacSignature(String value, String secret) { | |
String result; |
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
/** | |
* Converts a color name to its corresponding hex string. | |
* | |
* @example getHexColor('orange') == '#ffa500' | |
* @param {String} colorValue The color name. | |
* @return {String} | |
*/ | |
var getColorNameFromHexColor = (function() { | |
var elem = document.createElement('div'); | |
var bg; |
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
/** | |
* Checks if the google.maps.Polygon.Path is inside the polygon. | |
* | |
* @see {@link https://developers.google.com/maps/documentation/javascript/overlays#Polygons} | |
* @see {@link http://gmaps-samples-v3.googlecode.com/svn/trunk/poly/pentagon.html} | |
* @see {@link http://debian.fmi.uni-sofia.bg/~sergei/cgsr/docs/clockwise.htm} | |
* @see {@link http://en.wikipedia.org/wiki/Curve_orientation} | |
* @param {google.maps.Polygon.Path} path | |
* @returns {boolean} | |
*/ |
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
/** | |
* Caesar cipher. | |
* | |
* @link http://en.wikipedia.org/wiki/Caesar_cipher | |
* @param {string} msg | |
* @param {number} shift | |
* @return {string} | |
*/ | |
function caesarCipher(msg, shift) { | |
var result = "", |
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
/** | |
* To ASCII. | |
* | |
* @param {string} text | |
* @returns {string} | |
*/ | |
function toAscii(text) { | |
var noAscii = 'áàãâäéèêëíìîïóòõôöúùûüçÁÀÃÂÄÉÈÊËÍÌÎÏÓÒÕÖÔÚÙÛÜÇ'; | |
var ascii = 'aaaaaeeeeiiiiooooouuuucAAAAAEEEEIIIIOOOOOUUUUC'; | |
var resultText = ''; |
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
/** | |
* Quicksort implementation. | |
* | |
* @see {@link http://en.wikipedia.org/wiki/Quicksort} | |
* @param {array} arr | |
* @result {array} Sorted array | |
.*/ | |
var quicksort = function(arr) { | |
function partition(arr, left, right) { |
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
// Binary Tree | |
// Author: Thiago Prates <tsprates@hotmail.com> | |
#include <stdio.h> | |
#include <stdlib.h> | |
typedef struct _node { | |
int data; | |
struct _node* left; | |
struct _node* right; |
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
# https://overthewire.org/wargames/bandit/ | |
bandit1 NH2SXQwcBdpmTEzi3bvBHMM9H66vVXjL | |
bandit2 rRGizSaX8Mk1RTb1CNQoXTcYZWU6lgzi | |
bandit3 aBZ0W5EmUfAf7kHTQeOwd8bauFJ2lAiG | |
bandit4 2EW7BBsr6aMMoJ2HjW067dm8EgX26xNe | |
bandit5 lrIWWI6bB37kxfiCQZqUdOIYfr6eEeqR | |
bandit6 P4L4vucdmLnm8I7Vl7jG1ApGSfjYKqJU | |
bandit7 z7WtoNQU2XfjmMtWA8u5rN4vzqu4v99S | |
bandit8 TESKZC0XvTetK0S9xNwm25STk5iWrBvP |
OlderNewer