Skip to content

Instantly share code, notes, and snippets.

View kleberandrade's full-sized avatar
Coffee and Code

Kléber de Oliveira Andrade kleberandrade

Coffee and Code
View GitHub Profile
@kleberandrade
kleberandrade / LogSystem
Last active August 29, 2015 14:04
Sistema de log criado em Java
package logproject;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
public final class LogSystem implements AutoCloseable {
private static LogSystem instance;
@kleberandrade
kleberandrade / Singleton
Created July 17, 2014 13:15
Singleton genérico criado em C# para Unity 3D
using UnityEngine;
public class Singleton<T> : MonoBehaviour where T : Component
{
private static T instance = null;
private static object lockSingleton = new object();
public static T Instance
{
@kleberandrade
kleberandrade / Oscillator
Created July 17, 2014 13:27
Componente para Unity 3D, que faz objetos oscilarem dentro do jogo, seja sua posição, rotação ou escala.
using UnityEngine;
using System.Collections;
public class Oscillator : MonoBehaviour
{
public OscillatorType oscillatorType = OscillatorType.Position;
public float period = 1.0f;
public float amplitude = 0.01f;
public Vector3 direction = Vector3.one;
public bool initRandomPeriod = false;
@kleberandrade
kleberandrade / StructSerialize
Created July 17, 2014 14:08
Serialização e desserialização de estruturas em C#
using System;
using System.Runtime.InteropServices;
internal static class StructSerialize<T>
{
public static T RawDeserialize(byte[] rawData)
{
return RawDeserialize(rawData, 0);
}
@kleberandrade
kleberandrade / Bezier
Created July 17, 2014 14:11
Curva de Bezier para Jogos criados na Unity 3D
using UnityEngine;
using System.Collections;
public class Bezier {
private Vector3 p0;
private Vector3 p1;
private Vector3 p2;
private Vector3 p3;
@kleberandrade
kleberandrade / Dialog
Created May 30, 2015 12:41
Código para gerenciar dialogos d personagens
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using System.Collections.Generic;
public struct DialogMessage
{
public string name;
public string message;
@kleberandrade
kleberandrade / SharedFileFork
Created March 15, 2016 17:31
Método de compartilhar informações entre processos utilizando um arquivo
#include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
#include<sys/types.h>
#include<fcntl.h>
#include<sys/stat.h>
int main(int argc, char *argv[])
{
int pid, fd, i,r;
@kleberandrade
kleberandrade / GeneticAlgorithmConsoleApp.cs
Created June 9, 2018 02:38
Algoritmo genético implementa na aula de Inteligência Artificial para Jogos Digitais (x^2)
using System;
using System.Collections.Generic;
namespace GeneticAlgorithmConsoleApp
{
public class Program
{
public static int RANDOM_SEED = 10;
public static Random random = new Random(RANDOM_SEED);
@kleberandrade
kleberandrade / InputManager.cs
Last active May 18, 2022 13:22
Creates the InputManager.asset file with the settings for N players using the Xbox One joystick in Windows 10
using System;
using System.IO;
namespace XboxOneJoystickInputManager
{
public class InputManager
{
public enum JoystickAxis
{
LeftStickHorizontal = 0,
from google_images_download import google_images_download
response = google_images_download.googleimagesdownload()
arguments = {"keywords":"Glass,Chair,Water Bottle, ","limit":100,"print_urls":True}
paths = response.download(arguments)
print(paths)