Skip to content

Instantly share code, notes, and snippets.

View mamigot's full-sized avatar

Miguel Amigot mamigot

View GitHub Profile

Cloudera's QuickStart VM Setup

$ cat /etc/redhat-release
  • Determine the IP address of the VM (make sure the network is configured on VirtualBox first; see "Network" below)
$ ifconfig
@mamigot
mamigot / PID controller.cpp
Last active May 28, 2020 00:49
PID controller. Uses the bilinear transformation.
#include <stdio.h>
#include <iostream>
#include <fstream>
#include "daq.h"
using namespace std;
// Easily toggle the P, I and D parts of the controller
#define CONTROLLER_P true
#define CONTROLLER_I true
#define CONTROLLER_D true
#include <iostream>
#include <mutex>
#include <map>
using namespace std;
// Map file paths to their respective files' mutexes
map<string, shared_ptr<mutex>> fileMutexes = {};
mutex fileMutexesAccess;

Barrier

Barrier.h

/*
  Barrier.h
 */

#include <mutex>
#include <condition_variable>
@mamigot
mamigot / ubuntu_virtualbox.sh
Last active July 27, 2016 14:17
Basic initial configuration of Ubuntu 12.04 on VirtualBox
# wget $URL_OF_THIS_RAW_SCRIPT -O - | sudo bash
#############################################################################################
# Basic initial configuration of Ubuntu 12.04 on VirtualBox
# (execute after installing the relevant ISO on the VM through VirtualBox: http://releases.ubuntu.com/12.04/)
#
#
# In order to access the VM from your host (e.g. OS X), forward the relevant ports on VirtualBox:
# Network -> Adapter 1 (NAT) -> Port Forwarding (http://stackoverflow.com/a/10532299/2708484)
#
#!/usr/bin/env bash
#
# Script for installing Ansible and the edX configuration repostory
# onto a host to enable running ansible to complete configuration.
# This script can be used by Docker, Packer or any other system
# for building images that requires having ansible available.
#
# Can be run as follows:
#
@mamigot
mamigot / docker-compose.yml
Created October 22, 2017 16:20
Ghost + Nginx + Let's Encrypt + Docker Compose
version: '2'
services:
nginx-proxy:
image: jwilder/nginx-proxy
container_name: nginx-proxy
ports:
- "80:80"
- "443:443"
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
@mamigot
mamigot / edx_version.sh
Created November 15, 2017 16:52
See which version of the Open edX platform you're running
root@openedx:/edx/app/edxapp/edx-platform$ git tag | grep "open-release" | tail -1
open-release/ginkgo.1rc1
@mamigot
mamigot / linear-regression-example
Last active December 2, 2022 22:47
Linear regression function in Python that you could use to predict your final grade in a course based on the grades you have received on various assessments:
import numpy as np
def linear_regression(X, y):
# Add a column of ones to X to represent the bias term
X = np.concatenate([np.ones((X.shape[0], 1)), X], axis=1)
# Compute the transpose of X
X_t = np.transpose(X)
# Compute the dot product of X_t and X
@mamigot
mamigot / rnn-example
Created December 2, 2022 22:57
RNN in Python that you could use to predict your final grade in a course based on the grades you have received on various assessments:
import tensorflow as tf
# Define the input data
X = np.array([
[10], # grade on first assessment
[20], # grade on second assessment
[30] # grade on third assessment
])
# Define the target variable