Skip to content

Instantly share code, notes, and snippets.

View matheusopedro's full-sized avatar

Matheus I. Pedro matheusopedro

View GitHub Profile
<?php
// Script para demonstrar o loop infinito em PHP sem travar
while (true) {
puts "Ola, eu estou em loop!<br />"; // troque essa linha pelo seu loop real
flush();
sleep(1);
}
@arthurxavierx
arthurxavierx / dfs.c
Created May 22, 2013 17:59
Algoritmo de Busca em Profundidade em um grafo. Encontra um vértice em um labirinto e o caminho até este.
/** dfs.c
* @author Arthur Xavier <arthur.xavierx@gmail.com>
* @usage
* $ gcc dfs.c
* $ ./a.out < maze1.txt
*/
#include <stdio.h>
#include <stdlib.h>
/**
@vincentbernat
vincentbernat / SearchDailymotion.scala
Created November 22, 2013 19:53
Gatling scenario with step up and quick ramp down
package dailymotion
import io.gatling.core.Predef._
import io.gatling.http.Predef._
import io.gatling.http.Headers.Names._
import scala.concurrent.duration._
import bootstrap._
import assertions._
object SearchDailymotion {
@mziwisky
mziwisky / Oauth2.md
Last active February 15, 2024 23:31
Oauth2 Explanation

OAUTH2

The Problem

I’m a web app that wants to allow other web apps access to my users’ information, but I want to ensure that the user says it’s ok.

The Solution

I can’t trust the other web apps, so I must interact with my users directly. I’ll let them know that the other app is trying to get their info, and ask whether they want to grant that permission. Oauth defines a way to initiate that permission verification from the other app’s site so that the user experience is smooth. If the user grants permission, I issue an AuthToken to the other app which it can use to make requests for that user's info.

Note on encryption

Oauth2 has nothing to do with encryption -- it relies upon SSL to keep things (like the client app’s shared_secret) secure.

@akexorcist
akexorcist / index.js
Last active November 17, 2022 11:25
Axios post method requesting with x-www-form-urlencoded content type. See https://axios-http.com/docs/urlencoded
const axios = require('axios')
/* ... */
const params = new URLSearchParams()
params.append('name', 'Akexorcist')
params.append('age', '28')
params.append('position', 'Android Developer')
params.append('description', 'birthdate=25-12-1989&favourite=coding%20coding%20and%20coding&company=Nextzy%20Technologies&website=http://www.akexorcist.com/')
params.append('awesome', true)
@Maqsim
Maqsim / 413-payload-too-large-fix.js
Last active May 21, 2024 12:23
HOW TO FIX "413 Payload too large" in NodeJS (Express)
const express = require('express');
const bodyParser = require('body-parser');
...
// Express 4.0
app.use(bodyParser.json({ limit: '10mb' }));
app.use(bodyParser.urlencoded({ extended: true, limit: '10mb' }));
// Express 3.0
@KelvinCampelo
KelvinCampelo / model.js
Created July 5, 2018 19:45
A Mongoose Schema/Model example using ES6
import mongoose, { Schema } from 'mongoose';
const peopleSchema = new Schema(
{
firstName: {
type: String,
required: true,
trim: true
},
lastName: {