Skip to content

Instantly share code, notes, and snippets.

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

Alex Jones AlexsJones

🧟‍♀️
View GitHub Profile
@AlexsJones
AlexsJones / main.c
Last active August 29, 2015 13:56
Memory mapping layout explained
/*
* =====================================================================================
*
* Filename: main.c
*
* Description:
*
* Version: 1.0
* Created: 02/17/14 07:56:15
* Revision: none
@AlexsJones
AlexsJones / gist:9069402
Last active August 29, 2015 13:56
uninitialized members
class Bar;
class Foo
{
public:
Foo()
{
};
Bar *bar;
InitBar()
@AlexsJones
AlexsJones / gist:9110933
Last active August 29, 2015 13:56
Potential interface rework
typedef enum { IPV4, IPV6 } jnx_address_family;
typedef struct jnx_socket
{
int socket;
jnx_address_family addrfamily;
}jnx_socket;
typedef void (*listen_callback)(char*,size_t,char*);
typedef void (*broadcast_listen_callback)(char*,size_t);
#ifndef __CONNECTION_CONTROL_H__
#define __CONNECTION_CONTROL_H__
typedef enum cstate { PRECONNECTION, HANDSHAKING, ENCRYPTING, DECRYPTING, SENDING };
typedef struct connection_state {
raw_peer *local; //raw peer will contain an RSA keypair
raw_peer *foreign; //foreign peer will contain half an RSA keypair
char *shared_secret;
cstate state;
@AlexsJones
AlexsJones / gist:9502697
Created March 12, 2014 08:02
await async giggity
/*
* =====================================================================================
*
* Filename: send_await.c
*
* Description:
*
* Version: 1.0
* Created: 03/12/14 07:35:02
* Revision: none
// CONNECT TO EC2
InputStream credentialsAsStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("AwsCredentials.properties");
Preconditions.checkNotNull(credentialsAsStream, "File 'AwsCredentials.properties' NOT found in the classpath");
AWSCredentials credentials = new PropertiesCredentials(credentialsAsStream);
AmazonEC2 ec2 = new AmazonEC2Client(credentials);
ec2.setEndpoint("ec2.eu-west-1.amazonaws.com");
// CREATE EC2 INSTANCES
import os,sys,getopt,argparse,shutil,configparser
#[GlobalOptions]
#COMPILER=gcc
#OUTPUT=pickle
#[CompilerOptions]
#OPTS=-o
#LIBS=-ljnxc
#SRC=*.c
/*
* =====================================================================================
*
* Filename: main.c
*
* Description:
*
* Version: 1.0
* Created: 04/08/14 13:19:50
* Revision: none
/*
* =====================================================================================
*
* Filename: main.c
*
* Description:
*
* Version: 1.0
* Created: 04/08/14 13:19:50
* Revision: none
/*
* =====================================================================================
*
* Filename: jnxsocket.c
*
* Description:
*
* Version: 1.0
* Created: 02/21/14 18:07:02
* Revision: none