Skip to content

Instantly share code, notes, and snippets.

#include <iostream>
#include <sstream>
#include <random>
#include <map>
using namespace std;
char toChar(int n) {
return n + '0';
}
@pplanel
pplanel / fizzbuzz
Last active February 19, 2017 17:36
FizzBuzz in 113 chars of Python
print ["%.0d%s%s"%(i if i%3 and i%5 else 0,"" if i%3 else "Fizz","" if i%5 else "Buzz")for i in range(-50, 50)]
@pplanel
pplanel / golang_job_queue.md
Created February 11, 2016 03:01 — forked from harlow/golang_job_queue.md
Job queues in Golang
@pplanel
pplanel / bst.c
Created April 3, 2016 03:40
binarySearchTree
#include <stdlib.h>
#include "bst.h"
void insert_into_tree(struct node **root, char *value)
{
// Caso a arvore esteja vazia (root==NULL) vamos criar um no
// auxiliar, setar seus dois ponteiros (left, right) para NULL
// e apontar root para este novo nó.
if(*root == NULL)
{
(function(GOAL){
function generateSeriesByGoal(goal, timeframe){
var newSeries = [];
var metaDividida = goal / timeframe;
for(var i = 0; i < timeframe; i++){
newSeries[i] = metaDividida;
}
@pplanel
pplanel / logging.c
Last active October 5, 2018 10:56
My first project in C
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
#include "l_logging.h"
#define LOG_FILE "server.log"

Keybase proof

I hereby claim:

  • I am pplanel on github.
  • I am pplanel (https://keybase.io/pplanel) on keybase.
  • I have a public key ASABe86x7BeavW4_YBBNh1km_RZkLROcKRufWL_zjXMUEQo

To claim this, I am signing this object:

@pplanel
pplanel / index1.htm
Last active October 24, 2018 17:13
server.py
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="initial-scale=1">
<title>Card</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/card/2.4.0/card.css">
<style>
@pplanel
pplanel / x11.c
Last active June 13, 2019 21:59
segfault on XSelectInput
#include <X11/Xlib.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <time.h>
#include <math.h>
#define NANOSECONDS_MULTIPLIER 1000000

Keybase proof

I hereby claim:

  • I am pplanel on github.
  • I am pedroplanel (https://keybase.io/pedroplanel) on keybase.
  • I have a public key ASDRGqDpQ-bq_-m2yeTAi26rEegNxitR87EdnORzkrqRBgo

To claim this, I am signing this object: