Skip to content

Instantly share code, notes, and snippets.

<?php
ini_set('memory_limit', '0');
// Configuración de la base de datos
$db_host = "mysql.service.bcdev";
$db_user = "root";
$db_pass = "magic";
function get_databases() {
global $db_host, $db_user, $db_pass;
@dilakv
dilakv / binary_search.go
Created October 28, 2021 01:04
Búsqueda binaria de un número entre el mínimo y el máximo
func busqueda_binaria(min uint64, max uint64, item uint64) uint64 {
var intentos uint64 = 0;
if(item < min || item > max){
return 0
}
for min <= max {
intentos++
var medio uint64 = (min + max) / 2
@dilakv
dilakv / ImageTools.ts
Last active June 13, 2021 03:56 — forked from SagiMedina/ImageTools.js
Resize and crop images in the Browser with orientation fix using exif
import EXIF from 'exif-js';
declare global {
interface Window {
WebKitBlobBuilder:any;
MozBlobBuilder:any;
}
}
const hasBlobConstructor = typeof (Blob) !== 'undefined' && (function checkBlobConstructor() {
try {
return Boolean(new Blob());
@dilakv
dilakv / Primes.rs
Created June 1, 2021 18:41
Generate N primes numbers with Rust
use std::time::{SystemTime, UNIX_EPOCH};
fn is_prime(num: u128) -> bool
{
let mut response: bool = true;
for i in (2..(num-1) as usize).step_by(1){
if (num % i as u128) == 0 {
response = false;
}
};
@dilakv
dilakv / servercurl.php
Created May 31, 2021 18:12
Download a file from server using php and curl
<?php
// create a new cURL resource
$ch = curl_init();
$URL = "HTTP - Direct-Link";
$filename = "nameofthefile.extension";
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, $URL);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Curso - PHP - Funciones Arrays</title>
</head>
<body>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Curso - PHP - For</title>
</head>
<body>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Curso - PHP - While</title>
</head>
<body>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Curso - PHP - While</title>
</head>
<body>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Curso - PHP - While</title>
</head>
<body>