Skip to content

Instantly share code, notes, and snippets.

View Pacheco95's full-sized avatar
🤓
Building awesome things

Michael Pacheco Pacheco95

🤓
Building awesome things
View GitHub Profile
@Pacheco95
Pacheco95 / recommend-system.java
Created December 7, 2018 22:28
Exemplo de código da construção de um experimento de Sistema de Recomendação Híbrido
// Algoritmos de filtragem colaborativa
Task BMF_F1 = new Task("BiasedMatrixFactorization-F1.out", "../../MyMediaLite-3.10/bin/rating_prediction --prediction-file=Predictions/F1/BiasedMatrixFactorization.txt --prediction-line={0},{1},{2},0 --training-file=BD/Sample2345.txt --test-file=BD/Sample1.txt --recommender=BiasedMatrixFactorization --recommender-options=\"num_factors=14 bias_reg=0.042 frequency_regularization=False learn_rate=0.064 num_iter=32 bold_driver=True\" > ../run/out/bc/predictionsCF/BiasedMatrixFactorization-F1.out");
Task BMF_F2 = new Task("BiasedMatrixFactorization-F2.out", "../../MyMediaLite-3.10/bin/rating_prediction --prediction-file=Predictions/F2/BiasedMatrixFactorization.txt --prediction-line={0},{1},{2},0 --training-file=BD/Sample1345.txt --test-file=BD/Sample2.txt --recommender=BiasedMatrixFactorization --recommender-options=\"num_factors=14 bias_reg=0.042 frequency_regularization=False learn_rate=0.064 num_iter=32 bold_driver=True\" > ../run/out/bc/predictionsCF/BiasedMatrixFactoriz
minikube stop; minikube delete &&
docker stop $(docker ps -aq) &&
rm -rf ~/.kube ~/.minikube &&
sudo rm -rf /usr/local/bin/localkube /usr/local/bin/minikube &&
launchctl stop '*kubelet*.mount' &&
launchctl stop localkube.service &&
launchctl disable localkube.service &&
sudo rm -rf /etc/kubernetes/ &&
docker system prune -af --volumes
Você deve criar localmente na sua máquina Linux um simples sistema de CI/CD
utilizando a tecnologia de containers. Você deve criar um cluster local de
Kubernetes, neste cluster você deve fazer o deploy de um VCS e um servidor de
automação de builds que serão as peças principais de um sistema de CI/CD. Uma
vez criado esse sistema de CI/CD ele deve ser capaz de construir simples
containers com uma aplicação Java e enviar a imagem criada para um Registry.
Uma vez com essa imagem no Registry o sistema deve conseguir fazer o deploy
dessa aplicação no cluster e quando houver a criação de novas versões da imagem
a aplicação deve se atualizar para usar a imagem mais nova. Recomendamos a
criação de uma simples aplicação java que fica apenas escrevendo em loop infinito
@Pacheco95
Pacheco95 / cond.c
Created January 30, 2019 21:15 — forked from rtv/cond.c
An example of using pthread's condition variables, showing how to block a main thread while waiting for worker threads to finish their work, without joining the threads. This could be useful if you want to loop the threads, for example.
#include <pthread.h>
#include <stdio.h>
#include <unistd.h>
#include <assert.h>
/* Compile like this:
gcc --std=c99 -lpthread cond.c -o cond
@Pacheco95
Pacheco95 / gitlab-markdown-toc.js
Created May 29, 2019 15:28 — forked from nisests/gitlab-markdown-toc.js
creates a gitlab markdown table of contents for a README.md page
// quick and dirty snippet to creates a gitlab markdown table of contents for a README.md page
// preview gitlab page and paste in browser console
var str = "";
$('.file-content')
.find('h1, h2, h3, h4, h5, h6, h7')
.each((i, node) => {
// node.tagName is H1 H2...
let indent = Number(node.tagName[1]) - 1;
// markdown mested lists are
// - xxx
@Pacheco95
Pacheco95 / setup-kubernetes-ubuntu-16.md
Created July 6, 2019 21:23 — forked from ruanbekker/setup-kubernetes-ubuntu-16.md
Install a 3 Node Kubernetes Cluster on Ubuntu 16

Master: Dependencies

apt update && apt upgrade -y
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -

cat <<EOF > /etc/apt/sources.list.d/kubernetes.list
deb http://apt.kubernetes.io/ kubernetes-xenial main
EOF
require('prompt-sync')()
entrada = require('prompt-sync')();
❯ cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.1 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.1 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
@Pacheco95
Pacheco95 / AvatarUpload.js
Created October 24, 2020 04:58
Example of avatar uploading with React.js, Material UI and Styled Components
import { Avatar, Button as MuiButton, Typography } from "@material-ui/core";
import { grey } from "@material-ui/core/colors";
import {
CloudUpload as MuiCloudUpload,
Delete as MuiDelete,
} from "@material-ui/icons";
import { spacing } from "@material-ui/system";
import React, { createRef, useState } from "react";
import styled from "styled-components";