Skip to content

Instantly share code, notes, and snippets.

View AlexsJones's full-sized avatar
🧟‍♀️

Alex Jones AlexsJones

🧟‍♀️
View GitHub Profile
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
int main(void)
{
fd_set bar;
struct timeval foo;
void load_obj(const char* filename, Mesh* mesh) {
ifstream in(filename, ios::in);
if (!in) { cerr << "Cannot open " << filename << endl; exit(1); }
vector<int> nb_seen;
string line;
while (getline(in, line)) {
if (line.substr(0,2) == "v ") {
istringstream s(line.substr(2));
glm::vec4 v; s >> v.x; s >> v.y; s >> v.z; v.w = 1.0;
@AlexsJones
AlexsJones / gist:3656951
Created September 6, 2012 14:40
example of threading
#include <iostream>
#include <jnx_headers/jnxlib.hpp>
#include <queue>
#include <sstream>
#include <vector>
using namespace std;
using namespace jnx;
int kill_spawn()
{
pid_t parent = getpid();
cout << "Current process ID is : " << parent << endl;
system("ps -ax | grep launch_pad > /tmp/process.tmp");
ifstream fs("/tmp/process.tmp");
string line;
int kill_spawn()
{
pid_t parent = getpid();
//Isn't this an ugly way of doing ATOI, but hey thats the way it goes
stringstream parent_string;
parent_string << parent;
cout << "Current process ID is : " << parent << endl;
int kill_spawn()
{
pid_t parent = getpid();
//Isn't this an ugly way of doing ATOI, but hey thats the way it goes
stringstream parent_string;
parent_string << parent;
cout << "Current process ID is : " << parent << endl;
string jnx::jnx_network::get_http_page(string host)
{
int sockid;
int bufsize;
char buffer[MAXHTMLBUF];
struct sockaddr_in socketaddr;
struct hostent *hostaddr;
struct servent *servaddr;
struct protoent *protocol;
#include <stdio.h>
#include <stdlib.h>
typedef struct node
{
struct node *next_node;
char *text;
}node;
int main(int argc, char **argv)
#include <stdio.h>
print_number(int *x)
{
++x;
printf("Number %d\n",x);
}
int main(int argc, char **argv)
{
char *getline(void)
{
char* accumulator = malloc(100);
char readBuf[100];
int accumulatorSize = 100;
*accumulator = '\0';
while (!feof(stdin))
{
fgets(readBuf, 99, stdin);