Skip to content

Instantly share code, notes, and snippets.

View joshcarp's full-sized avatar

Joshua Carpeggiani joshcarp

View GitHub Profile
@joshcarp
joshcarp / cloudSettings
Last active January 14, 2020 00:43
New sysl directory structure
{"lastUpload":"2020-01-14T00:43:01.806Z","extensionVersion":"v3.4.3"}
@joshcarp
joshcarp / Makefile
Last active February 12, 2020 04:22
Sysl makefile
# User guide:
# make input=<inputfile> app=<appname>
# This will create a directory `app` and generate code into it
# if this script doesn't run, try running `pip2 uninstall sysl` or
# `pip uninstall sysl` as make might be running an old sysl version
TMP = .tmp# Cache the server lib directory in tmp
SERVERLIB = /var/tmp
TRANSLOCATION = .tmp/server-lib/codegen/transforms
TRANSFORMS= svc_error_types.sysl svc_handler.sysl svc_interface.sysl svc_router.sysl svc_types.sysl
/* A simple client program for server.c
To compile: gcc client.c -o client
To run: start the server, then the client */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
@joshcarp
joshcarp / Makefile
Created April 2, 2020 08:58
Makefile for COMPSYS
all:uni
PROJECTNAME=webscraper
PRIVATEKEY=/Users/joshcarp/private_keys/jcarpeggiani_key
SERVER=jcarpeggiani@111.111.111.111
uni:
scp -i $(PRIVATEKEY) -r ../$(PROJECTNAME) $(SERVER):~/$(PROJECTNAME)
ssh -i $(PRIVATEKEY) $(SERVER)
@joshcarp
joshcarp / Dockerfile
Last active April 2, 2020 09:30
Makefile for docker for compsys
FROM gcc:9.2
COPY . /usr/src/myapp
WORKDIR /usr/src/myapp
RUN make
CMD ["./main"]
@joshcarp
joshcarp / launch.json
Created April 3, 2020 10:40
c debugger
{
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceRoot}/bin/client.o", // Path to your executable, DONT INCLUDE ARGS
"args": ["google.com"], // Arguments here as strings, seperated: ["arg1", "arg2"]
"cwd": "${workspaceFolder}",
@joshcarp
joshcarp / package.tmpl
Last active May 5, 2020 01:03
sysl-catalog custom templates
---
id: Package-{{.PackageName}}
title: {{.PackageName}}
sidebar_label: {{.PackageName}}
---
## Integration diagram
{{.Integration.Img}}
package mapsorter
import (
"reflect"
"sort"
)
func SortedKeys(m interface{}) []string {
keys := reflect.ValueOf(m).MapKeys()
ret := make([]string, 0, len(keys))
package website_from_gcs
import (
"archive/zip"
"github.com/joshcarp/gop"
gop3 "github.com/joshcarp/gop/gop"
"github.com/joshcarp/gop/gop/gop_gcs"
"github.com/spf13/afero"
"github.com/spf13/afero/zipfs"
"mime"
@joshcarp
joshcarp / vendor-cloudfunctions.sh
Last active December 4, 2020 02:35
Example of how to deploy cloud functions with vendor directories, run vendor-cloudfunctions.sh right before running cloud deploy
#!/bin/bash
module=$(cat go.mod | grep module | cut -d " " -f2)
mkdir -p ./vendor/$module
cp -r pkg go.mod go.sum ./vendor/$module
echo "moving files to $module"
rm -rf go.mod go.sum