Skip to content

Instantly share code, notes, and snippets.

View Bevilacqua's full-sized avatar

Jacob Bevilacqua Bevilacqua

View GitHub Profile
@Bevilacqua
Bevilacqua / The C Language: 1.9 Character Arrays
Created August 3, 2012 20:24
The C Language: 1.9 Confusing function copy();
/*I copied this word for word with the intentions of interpreting it later but i can't figure out what the function copy is doing!*/
#include <stdio.h>
#define MAXLINE 1000 /*Maximum Input Line Length*/
int getline(char s[],int lim);
void copy(char to[],char from[]);
int main() {
int len; /*Current line length*/
int max; /*maximum length seen so far*/
char line[MAXLINE]; /*current input line*/
@Bevilacqua
Bevilacqua / MainGame.java
Created December 26, 2012 16:35
Stack Log When i run debug mode
package me.bevilacqua.game;
import java.awt.Canvas;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.image.BufferStrategy;
import java.awt.image.BufferedImage;
import java.awt.image.DataBufferInt;
#include <stdio.h>
#include <string.h>
void find_variants(char *input, char* working, int size);
void bin_str_func(char *input);
int main(int argc, char *argv[])
{
bin_str_func(argv[1]);
return 0;
@Bevilacqua
Bevilacqua / common_words.js
Created February 11, 2017 13:32
Search between an HTML document's body tags and find the most common words
$(function() {
alert("DOM loaded");
parseHTML();
});
function parseHTML() {
var words = {};
var conent = "";
content = $('body').html();
alert(content);
# Use Ubuntu as os
FROM ubuntu:16.04
# Passed Environment variables
ARG GIT_USERNAME
ARG GIT_TOKEN
# Packages & Environment Variables
ENV SRP_ROOT /Serpico
ENV GEM /usr/local/rvm/rubies/ruby-2.1.5/bin/gem
1. ```sudo yum update -y```
2. ```sudo yum install -y docker```
3. ```sudo service docker start```
4. ```sudo usermod -a -G docker ec2-user```
5. Log out of SSH and Log back in
6. Verify ec2-user can run docker commands with ```docker info```
7. Bring in Docker file ```curl https://gist.githubusercontent.com/Bevilacqua/5754480c2af1e1d222b93c82402533f7/raw/0857a0b2f4d7047ed5525de46b86c7e70b312375/Dockerfile > Dockerfile```
8. Build a docker image ```docker build --build-arg GIT_USERNAME=INSERT-USERNAME --build-arg GIT_TOKEN=INSERT-TOKEN --no-cache -t serpico .```
9. Launch the server ```docker run -it -p 443:8443 serpico```
10. NOTE: USE HTTPS PROTOCOL
#!/bin/bash
if [ $# -lt 2 ]
then
echo "Usage: ./serpico_setup GIT_USERNAME GIT_PASSWORD"
exit
fi
curl https://gist.githubusercontent.com/Bevilacqua/5754480c2af1e1d222b93c82402533f7/raw/Dockerfile > Dockerfile
docker build --build-arg GIT_USERNAME=$1 --build-arg GIT_TOKEN=$2 --no-cache -t serpico .
clear
read -r -p "Would you like to initialize the db. If you choose no you should have a db/master.db in the current directory. [y/N] " response
set -e
instanceCount=`docker ps -q | wc -l`;
if [[ "$instanceCount" != "0" ]]
then
docker kill $(docker ps -q)
fi
if [[ "$1" == "--force" ]]
@Bevilacqua
Bevilacqua / serpico.cron
Last active August 30, 2017 06:39
serpico.cron
15 03 * * * sudo /home/ec2-user/certbot-auto renew --pre-hook 'docker kill $(docker ps -q)' --post-hook 'sudo /bin/cp -rL /etc/letsencrypt/live/reporting.hacklabs.com/. /home/ec2-user/db/certs --remove-destination; sudo sh /home/ec2-user/deploy_serpico.sh --force' --debug
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.2/Chart.bundle.min.js"></script>
</head>
<body>
<canvas id="myChart" width="450" height="200"></canvas>
<script>
var androidData = [
{x: 1, y: .1},
{x: 2, y: .2},