Skip to content

Instantly share code, notes, and snippets.

View JAChapmanII's full-sized avatar

Jeff Chapman II JAChapmanII

View GitHub Profile
@JAChapmanII
JAChapmanII / protocol.ts
Created October 5, 2017 12:46
snipped generated ts
module comet_proto {
export interface Client {
connect(nick:string);
disconnect(nick:string);
message(channel:string, nick:string, message:string);
move(nick:string, nx:number, ny:number, ox:number, oy:number);
nicklist(nicks:string[]);
tile(world:string, wx:number, wy:number, tx:number, ty:number);
warp(nick:string, nx:number, ny:number);
}
@JAChapmanII
JAChapmanII / comefrom.cp
Created October 5, 2017 10:32
loop comefrom
#include <stdio.h>
int main(int argc, char **argv) {
int i = 10;
comefrom loop;
if(i < 0) {
stop:;
}
@JAChapmanII
JAChapmanII / chatServer.cpp
Last active July 2, 2017 12:25
chatServer.cpp - indigo chat server
#include <iostream>
#include <string>
using namespace std;
#include <oil/util.hpp>
#include <oil/db/pgsql.hpp>
#include <indigo/server.hpp>
#include <indigo/client.hpp>
#include <indigo/protoserver.hpp>
@JAChapmanII
JAChapmanII / out.txt
Created December 18, 2016 13:23
coming back to old code
[jac@rasa gapi]$ m
g++ -o gapi gapi.cpp git.cpp -lgit2 -std=c++11 -g -rdynamic
[jac@rasa gapi]$ ./gapi
branch: future
branch: master
branch: sqlite
Segmentation fault (core dumped)
[jac@rasa gapi]$
@JAChapmanII
JAChapmanII / chatServer.cpp
Last active October 29, 2016 17:03
current indigo chat server impl
#include <iostream>
#include <string>
#include <vector>
using namespace std;
#include <oil/util.hpp>
#include <indigo/server.hpp>
#include <indigo/client.hpp>
#include "protocol.hpp"
#include "martial.hpp"
#include <iostream>
using std::cout;
using std::endl;
#include <string>
using std::string;
#include "db/sqlite.hpp"
struct Test {
int a;
@JAChapmanII
JAChapmanII / pchain.c
Created September 11, 2016 15:47
pchain - primes and patterns
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
uint64_t *prime = NULL, pCount = 0;
uint64_t primeByN(uint64_t k, uint64_t n) {
uint64_t j;
for(j = 0; j < n; ++j)
if(k % prime[j] == 0)
@JAChapmanII
JAChapmanII / EventLog.cs
Created November 6, 2015 22:24
future event log
class EventLog {
class Event {
DateTime when;
// can track when event started as well, lets you loop back through and find failed tasks
Key key;
}
Event[] events;
int nextPush = 0;
int nextPop = 0;
@JAChapmanII
JAChapmanII / flash drive
Created October 1, 2015 22:31
flash drive
Device Boot Start End Sectors Size Id Type
>> Free space 2048 538989390 538987343 257G
/dev/sdh1p1 1936028272 3787887330 1851859059 883G 68 unknown
/dev/sdh1p2 1330184192 1869160479 538976288 257G 79 unknown
/dev/sdh1p3 538989391 1937352302 1398362912 666.8G 53 OnTrack DM6 Aux3
/dev/sdh1p4 1394627663 1394648999 21337 10.4M 49 unknown
Free space 1394649088 1936028271 541379184
@JAChapmanII
JAChapmanII / rex.cpp
Last active September 16, 2015 17:16
c++ rand
#include <random>
using std::random_device;
using std::uniform_int_distribution;
using std::generate_canonical;
int main(int, char **) {
// makes random numbers
random_device engine{};
// generate in [0, 2]