This file contains hidden or 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
<?php | |
function mlt_valida_input($input) { | |
$pattern = '[^A-Za-z0-9.]'; | |
return ereg($pattern, $input); | |
} | |
function mlt_read_code($input) { | |
if (mlt_valida_input($input)) | |
return 1; | |
This file contains hidden or 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
$buffer = preg_replace('/(http([^\s]+))/', '<a target="_blank" href="\\1">\\1</a>', $buffer); | |
$buffer = preg_replace('/(image:)([^\s]+)/', | |
'<img style="float: right; margin: 0px 0px 15px 15px; width: 150px;" src="\\2"/>', $buffer); | |
This file contains hidden or 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
#include <stdio.h> | |
#include <assert.h> | |
#define DEBUG(res) printf("\n%s in '%s' on function %s() line %d, tests_run: %d, tests_ok: %d, tests_fail: %d\n", \ | |
res ? "success" : "fail", __FILE__, __func__, __LINE__, tests_run, tests_ok, (tests_run-tests_ok)) | |
#define _assert(test) do { if (!(test)) { DEBUG(test); tests_run++; return 1; } \ | |
DEBUG(test); tests_run++; tests_ok++; } while(0) | |
int tests_ok = 0; | |
int tests_run = 0; |
This file contains hidden or 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
# source /etc/profile.d/32dev.sh | |
# export ARCH=i486 | |
# source *info; wget -c $DOWNLOAD; sh *SlackBuild | |
# installpkg /tmp/OpenAL-1.16.0-i486-1_SBo.tgz |
This file contains hidden or 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
class AreUFuknWithMe { | |
let rake = 0.26; | |
var total: Double = 0; | |
let bills: [Double] = [ 1, 1.87, 2, 4.3, 6.57 ]; | |
init() { | |
var x = 0; | |
for (; x<4; x++) { | |
println("Duh") |
This file contains hidden or 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
// algoritmo: res1 = sum(digits[0-9] * 10...2) % 11; res2 = sum(digits[0-10] * 11...2) % 11 | |
// if (digit10 == res1 && digit11 && res2) { cpf valido } | |
func checkIfCPFisValid(obj: AnyObject?) -> Bool | |
{ | |
var input: String = "" | |
if let object = obj as? UITextField { | |
input = object.text! | |
} |
This file contains hidden or 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
initial - representa o valor inicial investido; | |
interest - a taxa de rendimento médio mensal; | |
months - o número de meses em que o investimento será realizado; | |
$ initial=50000; interest=1.00961; months=60; for i in `seq 1 $months`; do initial=`echo "scale=2; $initial * $interest"|bc`; printf "month %2d, r$ %12.2f\n" $i $initial; done | |
month 1, r$ 50480.50 | |
month 2, r$ 50965.62 | |
month 3, r$ 51455.40 | |
month 4, r$ 51949.88 | |
month 5, r$ 52449.12 |
This file contains hidden or 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/bash | |
# https://alex.mulatinho.net/2016/08/17/desafio-shell-script-001/ | |
# Alexandre Mulatinho - http://alex.mulatinho.net - 20160820 | |
# | |
# run tests: | |
# $ ( TESTES=$(( (RANDOM % 20) + 1 )); echo $TESTES; \ | |
# for i in `seq 1 $TESTES`; \ | |
# do N=$(( (RANDOM % 5) + 1 )) ; echo -n "$N "; \ | |
# for x in `seq 1 $N`; do DIA=$(( (RANDOM % 31) + 1)); echo -n "$DIA "; done; \ | |
# echo; done; echo $(( (RANDOM % 12) +1 )) ) | ./challenge001.sh |
This file contains hidden or 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/bash | |
# amazon s3 upload file code | |
# written by Alexandre Mulatinho < alex @ mulatinho . net > | |
# Wed Oct 26 09:30:54 BRT 2016 | |
# use -> ./s3upload.sh hostAmazon yourBucketName yourFilename | |
[ ! "$3" ] && echo "use: $0 <host> <bucket> <file>" && exit 1 | |
dateNow="`TZ=Africa/Bumako date "+%a, %0e %b %Y %T %z"`" | |
host="$1" |
This file contains hidden or 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
/* Upload to Amazon S3 without AWS-SDK or other modules | |
* Alexandre Mulatinho <alex at mulatinho.net> 2016 | |
* | |
* You will need to change: | |
* - YOUR_FILENAME_HERE | |
* - YOUR_BUCKET_HERE | |
* - AWS_SECRET_KEY_HERE | |
* - AWS_ACCESS_KEY_HERE */ | |
var https = require("https"); |
OlderNewer