Skip to content

Instantly share code, notes, and snippets.

View rdeioris's full-sized avatar

Roberto De Ioris rdeioris

View GitHub Profile
@rdeioris
rdeioris / router_mkdir.c
Last active July 10, 2016 23:15
uwsgi router_mkdir.c
#include <uwsgi.h>
static int router_mkdir_func(struct wsgi_request *wsgi_req, struct uwsgi_route *ur) {
char **subject = (char **) (((char *)(wsgi_req))+ur->subject);
uint16_t *subject_len = (uint16_t *) (((char *)(wsgi_req))+ur->subject_len);
struct uwsgi_buffer *ub = uwsgi_routing_translate(wsgi_req, ur, *subject, *subject_len, ur->data, ur->data_len);
if (!ub) return UWSGI_ROUTE_BREAK;
public static class PoolManager
{
private const int initialItems = 10;
private static Dictionary<Type, Queue<object>> pools;
public static T Get<T>() where T : class, new()
{
if (!pools.ContainsKey(typeof(T)))
{
pools[typeof(T)] = new Queue<T>() as Queue<object>;
@rdeioris
rdeioris / first.c
Last active October 19, 2017 13:19
First C program
#include <stdio.h>
#include <stdlib.h>
int aiv_strlen(char *str)
{
// 100 100
char *original_ptr = str;
while(*str) {
str++;
clang -o engine.exe -I glfw-3.2.1.bin.WIN64/include/ -L glfw-3.2.1.bin.WIN64/lib-vc2015/ engine.c -lglfw3dll -lopengl32
#include "aiv_math.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
struct player
{
int width;
int height;
char *name;
#include "aiv_math.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
struct player
{
int width;
int height;
char *name;
static void Main(string[] args)
{
int width = 80;
int height = 20;
// iterate each y
for (int y = 0; y < height; y++)
{
// iterate each x
for (int x = 0; x < width; x++)
static void DrawChessboard(int width, int height)
{
// iterate each y
for (int y = 0; y < height; y++)
{
// iterate each x
for (int x = 0; x < width; x++)
{
// on pair y, draw black odd x
if (y % 2 == 0)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MoveTowards : MonoBehaviour
{
public float speed;
public Transform myBase;
using UnityEngine;
public class FindBestMineral : MonoBehaviour
{
// Use this for initialization
void Start()
{