Skip to content

Instantly share code, notes, and snippets.

Avatar
🏃‍♂️

Aaron Cruz mraaroncruz

🏃‍♂️
View GitHub Profile
@mraaroncruz
mraaroncruz / Dockerfile
Created Mar 4, 2019 — forked from teamon/Dockerfile
elixir + phoenix + node dockerfile
View Dockerfile
########################################
# 1. Build nodejs frontend
########################################
FROM node:10.9-alpine as build-node
# prepare build dir
RUN mkdir -p /app/assets
WORKDIR /app
# set build ENV
@mraaroncruz
mraaroncruz / deploy.rb
Created Feb 28, 2019 — forked from larrylv/deploy.rb
mina script for Phoenix deployment
View deploy.rb
require 'mina/git'
set :domain, 'your_domain'
set :deploy_to, 'your_path_on_server'
set :repository, 'your_git'
set :branch, 'master'
set :app_name, 'your_app_name'
set :shared_paths, ['log']
@mraaroncruz
mraaroncruz / gist:b3f4546bcba45130496d62587b46f62b
Created Jun 18, 2018 — forked from TeWu/gist:1234573
TCP client and multithreaded server in 14 lines of Ruby code
View gist:b3f4546bcba45130496d62587b46f62b

TCP client and multithreaded server in 14 lines of Ruby code

Server:

require "socket"
server = TCPServer.open(2626)
loop do
	Thread.fork(server.accept) do |client| 
		client.puts("Hello, I'm Ruby TCP server", "I'm disconnecting, bye :*")
@mraaroncruz
mraaroncruz / wol.rb
Last active Jun 15, 2018 — forked from scharfie/wol.rb
A ruby script which sends out a magic packet to wake up your PC
View wol.rb
#!/usr/bin/ruby
# wol.rb: sends out a magic packet to wake up your PC
#
# Copyright (c) 2004 zunda <zunda at freeshell.org>
# Modified by scharfie <scharfie at gmail dot com>
#
# This program is free software. You can re-distribute and/or
# modify this program under the same terms of ruby itself ---
# Ruby Distribution License or GNU General Public License.
#
@mraaroncruz
mraaroncruz / Dockerfile
Created Feb 21, 2018 — forked from treeder/Dockerfile
multi-stage build
View Dockerfile
# build stage
FROM golang:alpine AS build-env
ADD . /src
RUN cd /src && go build -o goapp
# final stage
FROM alpine
WORKDIR /app
COPY --from=build-env /src/goapp /app/
ENTRYPOINT ./goapp
@mraaroncruz
mraaroncruz / dockerhub-v2-api-user.sh
Created Feb 20, 2018 — forked from kizbitz/dockerhub-v2-api-user.sh
Get the list of images and tags for a Docker Hub user account.
View dockerhub-v2-api-user.sh
#!/bin/bash
# Example for the Docker Hub V2 API
# Returns all imagas and tags associated with a Docker Hub user account.
# Requires 'jq': https://stedolan.github.io/jq/
# set username and password
UNAME=""
UPASS=""
@mraaroncruz
mraaroncruz / README-setup-tunnel-as-systemd-service.md
Created Feb 2, 2018 — forked from drmalex07/README-setup-tunnel-as-systemd-service.md
Setup a secure (SSH) tunnel as a systemd service. #systemd #ssh #ssh-tunnel #ssh-forward
View README-setup-tunnel-as-systemd-service.md

README

Create a template service file at /etc/systemd/system/secure-tunnel@.service. The template parameter will correspond to the name of target host:

[Unit]
Description=Setup a secure tunnel to %I
After=network.target
@mraaroncruz
mraaroncruz / autossh.service
Created Jan 25, 2018 — forked from thomasfr/autossh.service
Systemd service for autossh
View autossh.service
[Unit]
Description=Keeps a tunnel to 'remote.example.com' open
After=network.target
[Service]
User=autossh
# -p [PORT]
# -l [user]
# -M 0 --> no monitoring
# -N Just open the connection and do nothing (not interactive)
@mraaroncruz
mraaroncruz / ethminer_ubuntu_nvidia.md
Created Jan 10, 2018 — forked from johnstcn/ethminer_ubuntu_nvidia.md
NVIDIA/CUDA ethminer setup under Ubuntu Server 16.04
View ethminer_ubuntu_nvidia.md

Headless Ethminer (nVidia) Setup Guide

Cian Johnston, July 2017

A couple of weeks ago, I decided I should put my gaming rig to work crypto mining. I did not expect to make any significant profit on this, it was more of a fun project to set up. However, there were a large number of tutorials and guides already out there, and many were more than a year out of date.

This guide assumes the reader already has a crypto wallet set up, is comfortable with Linux and the command line, and knows how to use Google if they run into problems.

The end result is an Ubuntu 16.04 LTS headless server running CUDA ethminer via systemd.

Hardware

@mraaroncruz
mraaroncruz / cmd.sh
Created Dec 30, 2017 — forked from kelvinn/cmd.sh
Example of using Apache Bench (ab) to POST JSON to an API
View cmd.sh
# post_loc.txt contains the json you want to post
# -p means to POST it
# -H adds an Auth header (could be Basic or Token)
# -T sets the Content-Type
# -c is concurrent clients
# -n is the number of requests to run in the test
ab -p post_loc.txt -T application/json -H 'Authorization: Token abcd1234' -c 10 -n 2000 http://example.com/api/v1/locations/