Skip to content

Instantly share code, notes, and snippets.

View aneury1's full-sized avatar
🎯
Focusing

Aneury Perez aneury1

🎯
Focusing
  • BairesDev
  • Dominican Republic
View GitHub Profile
int main(int argc, char** argv)
{
SDL_Init(SDL_INIT_EVERYTHING);
SDL_Surface *screen;
screen = SDL_SetVideoMode(640, 480, 32, SDL_SWSURFACE);
// screen = SDL_SetVideoMode(640, 480, 32, SDL_SWSURFACE|SDL_FULLSCREEN);
bool running = true;
const int FPS = 30;
Uint32 start;
while(running) {
void Swap(int32_t& num)
{
int swapped = ((num>>24)&0xff) | // move byte 3 to byte 0
((num<<8)&0xff0000) | // move byte 1 to byte 2
((num>>8)&0xff00) | // move byte 2 to byte 1
((num<<24)&0xff000000); // byte 0 to byte 3
num = swapped;
}
static bool ENTRADA_REALIZADA = false;
char getch(void)
{
ENTRADA_REALIZADA = true;
#if defined _WIN32 || defined _WIN64
char CARACTERE;
HANDLE CONSOLE;
DWORD ESCRITA = 0, NUMCARAC;
CONSOLE = GetStdHandle(STD_INPUT_HANDLE);
#include <iostream>
#include <windows.h>
struct Character
{
int x,y;
char ch;
};
Character **text_matrix;
R8 = (R5 * 527 + 23) >> 6;
G8 = (G6 * 259 + 33) >> 6;
B8 = (B5 * 527 + 23) >> 6;
...and for 24-bit to 16-bit :
R5 = (R8 * 249 + 1014) >> 11;
G6 = (G8 * 253 + 505) >> 10;
B5 = (B8 * 249 + 1014) >> 11;
unsigned char *LoadBitmapFile(char *filename, BITMAPINFOHEADER *bitmapInfoHeader)
{
FILE *filePtr; //our file pointer
BITMAPFILEHEADER bitmapFileHeader; //our bitmap file header
unsigned char *bitmapImage; //store image data
int imageIdx=0; //image index counter
unsigned char tempRGB; //our swap variable
//open filename in read binary mode
filePtr = fopen(filename,"rb");
unsigned char* readBMP(char* filename)
{
int i;
FILE* f = fopen(filename, "rb");
unsigned char info[54];
fread(info, sizeof(unsigned char), 54, f); // read the 54-byte header
// extract image height and width from header
int width = *(int*)&info[18];
int height = *(int*)&info[22];
@aneury1
aneury1 / digitalocean-promo-cupon-code-free-trial.md
Created May 2, 2018 04:01
DigitalOcean Coupon Code $35 / $100 1 Year Free Trial - April 2018

alt text

Digital Ocean Promo Coupon Code $35 / $100 1 Year Free Trial

1) Get $35 / $25 / $20 / $10 free DigitalOcean Credit.

2) Get DigitalOcean 1 Year Free Trial.

3) Get $100 Credit For 60 Days. $100 Free Credits

#this command let you establish route from Eth port to another port.
cd /etc/ && nano rc.local
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8069
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 443 -j REDIRECT --to-port 8070
# reboot (To see the change immediately. Reboot the machine)