This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int main(...) | |
{ | |
srand(time(NULL)); | |
while (true) { | |
int nmin = 220; | |
int nmax = 550; | |
int x = nmin + (std::rand() % (nmax - nmin + 1)); | |
printf("%i\n", x); | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for (int i = 0; i < spawnedFish.size(); i++) { | |
IND_Entity2d * fish = spawnedFish.at(i); | |
for (int j = 0; j < 20; j++) { | |
if ((x - j) == fish->getPosX()) { | |
x -= 10; | |
} | |
else if ((x + j) == fish->getPosX()) { | |
x += 10; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash.exe | |
# This script opens a given directory up in the Windows file explorer. I did | |
# this to make it easy when opening directories in the Cygwin system using | |
# the explorer. | |
# | |
# To install: | |
# | |
# $ touch /usr/bin/opene | |
# $ vim /usr/bin/opene |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Log a green debug message in the corner of the game screen. Generally | |
* used for situations in which an operation has completed successfully. | |
*/ | |
#define BL_LOG_GREEN(str) (GEngine->AddOnScreenDebugMessage(-1, 5.f, \ | |
FColor::Green, \ | |
TEXT(str))) | |
/** | |
* Log a yellow debug message in the corner of the game screen. Generally |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let g:syntastic_cpp_compiler_options = '-std=c++0x' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import subprocess | |
# rstrip() is used to remove the line terminator at the end of most command output. | |
host = subprocess.check_output(['command', .. args ..], stderr=subprocess.STDOUT).rstrip() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tasks = [] | |
def task(meth): | |
tasks.append(meth) | |
def new(*args): return meth(*args) | |
return new | |
def call_task(task_id): | |
(tasks[id])() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def init(): | |
# ... Initialize entities ... | |
def update(): | |
# ... Update entities ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
char * readfile(const char * f) | |
{ | |
ifstream in(f, std::ifstream::binary); | |
in.seekg(0, in.end); | |
int size = in.tellg(); | |
in.seekg(0); | |
char * buf = new char[size]; | |
in.read(buf, size); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main(void) | |
{ | |
int pid; | |
pid = fork(); | |
if(pid > 1) { | |
printf("I AM THE PARENT PROCESS\n"); | |
} else if(pid == 0) { | |
printf("I AM THE CHILD PROCESS\n"); |