Skip to content

Instantly share code, notes, and snippets.

View KennedyTedesco's full-sized avatar

Kennedy Tedesco KennedyTedesco

View GitHub Profile
#include <stdio.h>
int main() {
int years[] = {2016, 2017, 2018};
char *langs[] = {"PHP", "GO", "Rust"};
// Ponteiro genérico, recebe qualquer endereço sem ser importar com o tipo associado
void *ptr;
// "ptr" agora tem o endereço do primeiro ano
#include <stdio.h>
#define LENGHT 5
char *langs[LENGHT] = {"PHP", "GO", "C", "Rust", "JS"};
int main() {
// Ponteiro
char *pc;
// Estudo sobre o básico de ponteiros e ponteiros de ponteiros lidando com inteiros.
#include <stdio.h>
#define LEN 5
int values[LEN];
int main() {
int *ptr; // Ponteiro
@KennedyTedesco
KennedyTedesco / ca.md
Created September 16, 2019 21:44 — forked from soarez/ca.md
How to setup your own CA with OpenSSL

How to setup your own CA with OpenSSL

For educational reasons I've decided to create my own CA. Here is what I learned.

First things first

Lets get some context first.

  1. Make sure mysql-client is installed. If not, then :
    sudo apt install mysql-client
	or
    sudo apt-get install mysql-client
  1. Open php.ini

; PHP's default character set is set to UTF-8.

Keybase proof

I hereby claim:

  • I am kennedytedesco on github.
  • I am ktp (https://keybase.io/ktp) on keybase.
  • I have a public key ASAMQyGez9p4-nF03B-BkbFf_7j4eZDHCyNzE0NXJA2ynQo

To claim this, I am signing this object:

@KennedyTedesco
KennedyTedesco / bench.php
Created September 28, 2016 00:36 — forked from nikic/bench.php
Benchmark of call_user_func_array vs switch optimization vs argument unpacking syntax
<?php error_reporting(E_ALL);
function test() {}
$nIter = 1000000;
$argNums = [0, 1, 2, 3, 4, 5, 100];
$func = 'test';
foreach ($argNums as $argNum) {
@KennedyTedesco
KennedyTedesco / ghost.txt
Last active September 5, 2016 16:12
Ghost in a subdir
# Nginx location:
location ^~ /blog {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://127.0.0.1:2368;
proxy_redirect off;
}
@KennedyTedesco
KennedyTedesco / gist:6173723
Last active May 8, 2019 11:15
Formatar número de telefone para o formato (11) 11111-1111
<?php
/**
*
* Formata um número de telefone para o formato (11) 11111-1111
*
* @author Kennedy Tedesco
* @param string $numero
* @return string
*/