Skip to content

Instantly share code, notes, and snippets.

View oliveira-andre's full-sized avatar
🖲️
Coding

André Oliveira oliveira-andre

🖲️
Coding
View GitHub Profile
@oliveira-andre
oliveira-andre / app.js
Created November 2, 2019 19:54
javascript as a pro
// show json as noob
let first_json = { programmer: 'Andre', hair_color: 'Black' }
let secound_json = { programmer: 'Noob guy', hair_color: 'yellow' }
console.log(first_json)
console.log(secound_json)
// show json as a pro:
console.log('%c my jsons', 'color: red; font-weight: bold;')
console.log({ first_json, secound_json })
@oliveira-andre
oliveira-andre / gist:cf8bc340e4d647212914fd73d277bd28
Created October 25, 2019 20:40
configure sql server on localmachine
sudo apt-get install freetds-dev
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
sudo add-apt-repository "$(curl https://packages.microsoft.com/config/ubuntu/16.04/mssql-server-2017.list)"
sudo apt-get updatesudo apt-get update
sudo apt-get install -y mssql-server
sudo /opt/mssql/bin/mssql-conf setup
systemctl status mssql-server
@oliveira-andre
oliveira-andre / zpreztorc
Created October 24, 2019 18:29
zpreztorc
#
# Sets Prezto options.
#
# Authors:
# Sorin Ionescu <[email protected]>
#
#
# General
#
class Unit < ApplicationRecord
store :data, accessors: %i[position phone email], coder: JSON
belongs_to :company, inverse_of: :units, optional: true
belongs_to :unit_parent, class_name: "Unit", foreign_key: "unit_id", optional: true
end
@oliveira-andre
oliveira-andre / class_methods_on_js_example.txt
Last active October 15, 2019 01:48
class methods and heritage on JS
class Spaceship {
constructor(name, crewQuantity) {
this.name = name,
this.crewQuantity = crewQuantity,
this.velocity = 0
}
speedUp(acceleration) {
return this.velocity += acceleration
}
@oliveira-andre
oliveira-andre / run docker mongodb
Last active June 3, 2019 18:48
run docker mongodb
sudo docker run -d \
--name=mongodb \
--restart=always \
-p 27017:27017 \
mongo:latest
@oliveira-andre
oliveira-andre / run docker redis
Last active November 12, 2019 00:25
run docker redis
sudo docker run -d \
--name=redis \
--restart=always \
-v redis:/var/lib/redis/data \
-p 6379:6379 \
redis:latest
@oliveira-andre
oliveira-andre / ubuntu_18_04_installing_cakephp.sh
Last active February 20, 2019 14:18
ubuntu_18_04_installing_cakephp.sh
#!/bin/sh
sudo su
echo "Installing and Reloading APACHE2"
apt install apache2
systemctl reload apache2.service
echo "adding the repository and installing php"
add-apt-repository -y ppa:ondrej/php
apt-get update
@oliveira-andre
oliveira-andre / install RStudio ubuntu18.04
Last active December 8, 2018 03:24
install RStudio ubuntu 18.04
# Download and Install R if you need put your current version of https://cran.r-project.org/
wget https://cran.r-project.org/bin/linux/ubuntu/bionic-cran35/dh-r_20180506~ubuntu18.04.1~ppa1_all.deb
sudo dpkg -i dh-r_20180506_ubuntu18.04.1_ppa1_all.deb
# Install, chaning the name of the package to the one you downloaded - perhaps easiest if you go to your Downloads directory - and you'll probably find that there are missing packages:
sudo dpkg -i rstudio-1.0.124-amd64.deb
@oliveira-andre
oliveira-andre / upping jupyter on docker
Last active July 14, 2022 08:23
upping jupyter on docker
#run jupyter
sudo docker run -d --rm \
--name=jupyter \
-p 8888:8888 \
-e JUPYTER_LAB_ENABLE=yes \
-v "${PWD}":/home/jovyan/work \
jupyter/datascience-notebook
#catch the token
sudo docker exec -it jupyter jupyter notebook list