Skip to content

Instantly share code, notes, and snippets.

View luizguilhermefr's full-sized avatar
🚚
truck.move(origin, destination);

Luiz Rosa luizguilhermefr

🚚
truck.move(origin, destination);
View GitHub Profile
@luizguilhermefr
luizguilhermefr / stonks.py
Created January 30, 2020 19:45
Stonks calculator
print("\033[31m STONKS \033[m")
print(35*"=")
print(" ")
initial = float(input("\033[32mINITIAL VALUE\033[m: "))
monthly = float(input("MONTHLY \033[32mAPPLICATION\033[m: "))
rate = float(input("\033[32mMONTHLY\033[m RATE (%): ")) / 100
time = int(input("\033[32mTOTAL\033[m YEARS: ")) * 12
amount = initial
@luizguilhermefr
luizguilhermefr / mergeintervals.php
Last active March 9, 2019 12:47
PHP merge intervals
<?php
/*
* PHP7 implementation of merging intervals
* It will remove intersections between intervals, for example: [(1, 5), (3,8), (12, 15)] will turn
* into [(1, 8), (12, 15)].
* Based on: https://www.geeksforgeeks.org/merging-intervals/
*/
function merge_intervals(array $data) : array {
@luizguilhermefr
luizguilhermefr / MainActivity.java
Last active January 31, 2019 13:40
Chromecast Sender Application
package io.github.luizguilhermefr.castcastcast;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.Menu;
import android.view.MenuItem;
import com.google.android.gms.cast.framework.CastButtonFactory;
import com.google.android.gms.cast.framework.CastContext;
@luizguilhermefr
luizguilhermefr / menu_main.xml
Last active January 31, 2019 13:37
Chromecast Sender Application
<!-- Place this file on res/menu (create the menu dir if not there) -->
<!-- You may also create the exit and cast strings on your res/values/string.xml -->
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context=".MainActivity">
<item
android:id="@+id/media_route_menu_item"
@luizguilhermefr
luizguilhermefr / AndroidManifest.xml
Last active January 31, 2019 13:46
Chromecast Sender Application
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="io.github.luizguilhermefr.castcastcast">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
@luizguilhermefr
luizguilhermefr / CastOptionsProvider.java
Last active January 31, 2019 13:34
Chromecast Sender Application
package io.github.luizguilhermefr.castcastcast;
import android.content.Context;
import android.text.format.DateUtils;
import com.google.android.gms.cast.framework.CastOptions;
import com.google.android.gms.cast.framework.OptionsProvider;
import com.google.android.gms.cast.framework.SessionProvider;
import com.google.android.gms.cast.framework.media.CastMediaOptions;
import com.google.android.gms.cast.framework.media.MediaIntentReceiver;
@luizguilhermefr
luizguilhermefr / index.html
Last active January 29, 2019 11:38
Chromecast receiver application.
<!DOCTYPE html>
<html lang="en">
<head>
<title>CastCastCast</title>
<link rel="stylesheet" href="main.css" media="screen"/>
<script type="text/javascript"
src="//www.gstatic.com/cast/sdk/libs/caf_receiver/v3/cast_receiver_framework.js">
</script>
</head>
<body>
\begin{figure}[htb]
\begin{center}
\begin{tikzpicture}
\pgfplotsset{width=13cm,compat=newest}
\begin{axis}[
scale only axis,,
yticklabel style={
/pgf/number format/fixed,
/pgf/number format/precision=5
},
@luizguilhermefr
luizguilhermefr / no-5fn-2
Created September 21, 2017 17:25
5FN Violation
╔═════════════════╦═══════════════════╦══════════════════════╗
β•‘ [PK][FK] seller β•‘ [PK][FK] company β•‘ [PK][FK] product β•‘
╠═════════════════╬═══════════════════╬══════════════════════╣
β•‘ 1 β•‘ Samsung β•‘ Hard drives β•‘
β•‘ 1 β•‘ Samsung β•‘ Phones β•‘
β•‘ 1 β•‘ Apple β•‘ Hard drives β•‘
β•‘ 1 β•‘ Apple β•‘ Phones β•‘
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•©β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•©β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•
@luizguilhermefr
luizguilhermefr / no-4fn-6
Created September 21, 2017 17:16
4FN Violation
╔═══════════════════╦═════════════════╦═══════════════════╗
β•‘ [PK][FK] employee β•‘ [PK][FK] skill β•‘ [PK][FK] language β•‘
╠═══════════════════╬═════════════════╬═══════════════════╣
β•‘ 1 β•‘ frontend β•‘ french β•‘
β•‘ 1 β•‘ frontend β•‘ portuguese β•‘
β•‘ 1 β•‘ frontend β•‘ spanish β•‘
β•‘ 1 β•‘ design β•‘ french β•‘
β•‘ 1 β•‘ design β•‘ portuguese β•‘
β•‘ 1 β•‘ design β•‘ spanish β•‘
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•©β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•©β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•