Skip to content

Instantly share code, notes, and snippets.

View ajpen's full-sized avatar

Anfernee Jervis ajpen

View GitHub Profile
@ajpen
ajpen / automate.c
Created August 26, 2014 03:14
Automates installation of removed packages from a copy of the apt-get log
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char* argv[]){
//buffer array
char buffer[120];
//array for the package name
@ajpen
ajpen / fcopy.c
Last active August 29, 2015 14:21
File copying program
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
int main(int argc, char* argv[]){
char buffer; //number of bits copied at once
FILE* source = fopen(argv[1],"r");
FILE* dest = fopen(argv[2],"w");
@ajpen
ajpen / Server functions.c
Created June 2, 2015 12:16
extracts query, absolute path and address line
const char* qextract(char* line) {
//get target line with query in it
const char* target = textract(line, 0);
int len = strlen(target);
char mtarget[len+1];
// make a more mallible copy
memcpy(mtarget, target,len);
// extract query from request-target
const char* temp = qextract(line);
int len = strlen(temp);
char query[len+1];
// make a usable copy of query
strncpy(query, temp,len+1);
/*---------------------------------------------------------
* Program: recshuffle.cpp
* Usage: ./recshuffle
*---------------------------------------------------------
* Description: Prints a random permutation of the string
* "helloworld" alongside the source string. This program
* uses a recursive approach instead of an iterative one
*_________________________________________________________
*/
/*---------------------------------------------------------
* Program: shuffle.cpp
* Usage: ./shuffle
*---------------------------------------------------------
* Description: Prints a random permutation of the string
* "helloworld" alongside the source string
*_________________________________________________________
*/
/* INCLUDES */
/* ---------------------------------------
* File: filecpy.cpp
* Usage: ./filecpy source destination
* ---------------------------------------
* Function: Copies the source file to
* the new file specified by the path
* called destination. The program
* creates the new file and then copies
* the contents of source to it.
* _______________________________________
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.provision :shell, path: "bootstrap.sh"
config.vm.network :forwarded_port, host: 9200, guest: 9200
config.vm.provider "virtualbox" do |v|
v.memory = 4000
v.cpus = 2
v.name = "ES-2.4"
end
end
# install openjdk-7
sudo apt-get purge openjdk*
sudo apt-get -y install openjdk-7-jdk
# Install elasticsearch
wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
echo "deb http://packages.elastic.co/elasticsearch/2.x/debian stable main" | sudo tee -a /etc/apt/sources.list.d/elasticsearch-2.x.list
sudo apt-get update && sudo apt-get install elasticsearch
sudo update-rc.d elasticsearch defaults 95 10
@ajpen
ajpen / vimrc
Last active October 20, 2016 10:27
My vimrc setup
"" Minimal setting and configuration
"" These settings makes editing less of a drag :)
"---------------------------------------------------------------------------------
" Use vim settings
set nocompatible
" changes backspace indentation behavior
set backspace=indent,eol,start