Skip to content

Instantly share code, notes, and snippets.

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

Alex Jones AlexsJones

🧟‍♀️
View GitHub Profile
#include <stdio.h>
int main()
{
FILE *fp;
fp = fopen("/Users/jonesax/Destkop/Scheduler/second.txt","r");
if( fp == NULL )
{
printf("\ncouldnt find");
return -1;
@AlexsJones
AlexsJones / main.c
Created May 25, 2012 10:46
Child getline problem
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char* argv[])
{
pid_t _pid;
// int _pipe[2];
@AlexsJones
AlexsJones / main.c
Created June 1, 2012 09:50
Getopt in C
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <unistd.h>
#define PARAMLEN 2
void print_params(void)
{
printf("Please enter the correct parameters...\n");
printf("-f %3d Specify a folder to search...\n");
@AlexsJones
AlexsJones / gist:2906366
Created June 10, 2012 15:59
addition to gitconfig for highlighting and shorthands
# ~/.gitconfig
[color]
ui = auto
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
int jnx_system::recursive_delete(std::string path)
{
DIR *dp;
struct dirent *ep;
char *dirname=new char[path.size()+1];
dirname[path.size()]=0;
memcpy(dirname,path.c_str(),path.size());
float normalise(int _inputsize,int range_min, int range_max,int _height_in_range)
{
int _intorange = _inputsize - range_min;
cout << "size into range " << _intorange << endl;
int size_of_range = range_max - range_min;
cout << "size of range " << size_of_range << endl;
float output = (_intorange / size_of_range);
@AlexsJones
AlexsJones / gist:3163452
Created July 23, 2012 12:45
port scanner
#include <string>
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
@AlexsJones
AlexsJones / gist:3236669
Created August 2, 2012 12:25
First part
/*
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 2012 <copyright holder> <email>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@AlexsJones
AlexsJones / gist:3377010
Created August 17, 2012 08:28
thread example
#include <iostream>
#include <jnx_headers/jnxlib.hpp>
using namespace std;
using namespace jnx;
class foo
{
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
int
main(void)
{
fd_set rfds;