Skip to content

Instantly share code, notes, and snippets.

View carlac2k's full-sized avatar

Carla Cabrita carlac2k

  • Portugal
View GitHub Profile
@carlac2k
carlac2k / has-characters.php
Created March 17, 2020 15:06 — forked from cferdinandi/has-characters.php
Test strings for letters, numbers, and special characters. Returns true if they exist, false if they don't. Forked from http://stackoverflow.com/a/9588010/1293256
<?php
// Does string contain letters?
function _s_has_letters( $string ) {
return preg_match( '/[a-zA-Z]/', $string );
}
// Does string contain numbers?
function _s_has_numbers( $string ) {
return preg_match( '/\d/', $string );
@carlac2k
carlac2k / aes_enc_dec.php
Created March 3, 2020 17:01 — forked from turret-io/aes_enc_dec.php
AES encryption/decryption in PHP
<?php
// DEFINE our cipher
define('AES_256_CBC', 'aes-256-cbc');
// Generate a 256-bit encryption key
// This should be stored somewhere instead of recreating it each time
$encryption_key = openssl_random_pseudo_bytes(32);
// Generate an initialization vector
// This *MUST* be available for decryption as well
@carlac2k
carlac2k / createcertificate.php
Created February 26, 2020 10:15 — forked from jlainezs/createcertificate.php
Creates a certificate using OpenSSL with PHP. sing.php could be used to sign a text with the pkey generated with createCertificate. verify.java shows how to load the certificate from a resource and a verification sample of the text signed with sign.php
/**
* Creates an OpenSSL certificate
* @param $dn Array Associative array "key"=>"value"
* @param $duration int Number of days which the certificate is valid
* @throws Exception If there are any errors
* @return Array Associative array with the security elements: "cer"=>self signed certificate, "pem"=>private key, "file"=>path to the files
*
* @see http://www.php.net/manual/en/function.openssl-csr-new.php
* @author Pep Lainez
*/
@carlac2k
carlac2k / configDB.php
Created February 14, 2020 18:50 — forked from ShaneCunn/configDB.php
Ajax php mysql DataTables example that get data from mysql database using ajax, that calls a php method
<?php
define('DB_SERVER', 'localhost');
define('DB_USERNAME', 'username');
define('DB_PASSWORD', 'passwordForDB');
define('DB_NAME', 'DatabaseName');
$DBconnect = mysqli_connect(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_NAME);
@carlac2k
carlac2k / ReadMe.md
Created January 14, 2020 20:37 — forked from fhorlaville/ReadMe.md
Robot Electronics ETH008 PHP controlling code - moved to https://github.com/fhorlaville/ETH008

This is my PHP library for controlling a Robot Electronics ETH008 unit. This unit has eight programmable relays and an Ethernet connector.

Here are the files:

  • functions.php This is the library with the functions you need to call

  • tests.php These are the unit tests for the functions library ; it shows how you use the functions

@carlac2k
carlac2k / miniconda_on_rpi.md
Last active December 9, 2019 19:49 — forked from simoncos/miniconda_on_rpi.md
Install Miniconda 3 on Raspberry Pi
@carlac2k
carlac2k / anaconda.md
Created August 24, 2019 18:46 — forked from bismarckjunior/anaconda.md
Anaconda: Instalação e uso.

N|Solid

Anaconda

Anaconda é uma plataforma de ciência de dados para Python. Possibilita a instalação de diferentes versões da linguagem Python com a criação de ambientes de desenvolvimento específicos. Esse manual descreve como instalar e utilizar o Anaconda no Windows.

Instalação

Para instalar o Anaconda no Windows siga os passos:

  1. Faça download da versão atual do Anaconda no site: www.continuum.io/downloads