Skip to content

Instantly share code, notes, and snippets.

View dejaime's full-sized avatar

Dejaime Antônio de Oliveira Neto dejaime

View GitHub Profile
@dejaime
dejaime / prune-docker.sh
Created December 17, 2023 23:27
Script to clear docker containers, images and volumes that I need every 6 months or so
#!/bin/sh
echo "Stopping all containers"
docker stop $(docker ps -a -q) || echo "Failed to stop containers, no containers running?";
echo "Pruning system (docker system prune -af)"
docker system prune -af
echo "Pruning volumes (docker volume prune -af)"
docker volume prune -af
@dejaime
dejaime / example.h
Last active October 21, 2018 16:55
Example code for parsing a YAML file, as seen in http://www.buildandgun.com/2014/02/yaml-yaml-aint-markup-language.html
/* *
* example.h
*
* "No" Copyright 2014 Dejaime <dejaime@Funny-Unix>
*
* http://www.buildandgun.com/2014/02/yaml-yaml-aint-markup-language.html
* Released under Public Domain.
* More information here:
* http://creativecommons.org/publicdomain/zero/1.0/
*
@dejaime
dejaime / gist:8533081
Last active January 3, 2016 23:09
Code Snippet to exemplify the usage of HLGE's first Input interpretation System prototype. It shows the entire process of creating and configuring Patterns using Basic Inputs and the Key Translator.
#include <iostream>
#include <string>
#include "Controller.h"
#include "KeyboardController.h"
#include "GestureInterpreter.h"
#include "DisplayManager.h"
#include "allegro5.h"
@dejaime
dejaime / BinaryLoadTest.cpp
Last active January 3, 2016 10:39
Comparison between direct binary data copy and the read, interpret, set method.
#include <iostream>
#include <unistd.h>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <time.h>
#define MAPW 7500
#define MAPH 7500
#define TEXT_FILE_NAME "mapAsText.map"
@dejaime
dejaime / gist:8428686
Last active January 3, 2016 07:19
Update() method of the GestureInterpreter class, HLGE
//Shortcut to call updateStep how many times necessary.
void GestureInterpreter::update() {
while (updateStep());
}
//Updates the Interpreter until it process all events or find a match, whatever comes first.
//May need to be called multiple times.
//Returns true on a match or false when it is empty.
bool GestureInterpreter::updateStep() {
@dejaime
dejaime / sysSprite.h
Created November 6, 2013 04:24
Drawing function for the sprite class of the open source game Spacerock Miners, as an example for the website BuildAndGun.com.
void draw(const int position_x, const int position_y, const unsigned int anim_current,
const unsigned int frame_current, const int rotation, const short int anim_dir, const float scale,
const bool flip_horizontal, const bool flip_vertical, const float taint_r, const float taint_g,
const float taint_b, const float taint_a, const unsigned int time_step);
@dejaime
dejaime / sprite.cpp
Last active December 26, 2015 06:59
Base Sprite Class snippet
class sprite {
private:
//All unshared data should come here, speed, rotation, etc.
sysSprite renderer*; //This is where the shared data is stored.
public:
sprite () {
//Initialize the sprite and set up the 'renderer' pointer.
}
};
#include <cstdio>
int main(){
printf("Hello World!");
return 0;
}