Skip to content

Instantly share code, notes, and snippets.

View alvadorn's full-sized avatar

Igor Sant'Ana alvadorn

View GitHub Profile
import java.util.Scanner;
public class TryCatchExample {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.println("\nDigite o palpite");
int userTry = TryCatchExample.tryDigit(scan);
}
public static int tryDigit(Scanner scan) {
@alvadorn
alvadorn / arch-linux-install.md
Last active June 16, 2020 23:30 — forked from mattiaslundberg/arch-linux-install
Minimal instructions for installing arch linux on an UEFI system with full system encryption using dm-crypt and luks

Install ARCH Linux with encrypted file-system and UEFI

The official installation guide (https://wiki.archlinux.org/index.php/Installation_Guide) contains a more verbose description.

dd if=archlinux.img of=/dev/sdX bs=16M && sync # on linux

  • Boot from the usb. If the usb fails to boot, make sure that secure boot is disabled in the BIOS configuration.

Set ptbr keymap

@alvadorn
alvadorn / middleware.py
Last active January 2, 2020 21:50
middleware for flask example
from flask import Flask, abort
app = Flask()
@app.before_request
def auth_middleware():
if not is_authenticated(user): // do your own checker
abort(401)

Keybase proof

I hereby claim:

  • I am alvadorn on github.
  • I am alvadorn (https://keybase.io/alvadorn) on keybase.
  • I have a public key ASDmSNFIIcpfQdlDds2znBx8iYKEW8uvMeWNoG8SSRMfHgo

To claim this, I am signing this object:

@alvadorn
alvadorn / customers_controller.rb
Created February 27, 2018 21:08
Example about params permission
class CustomersController < ApplicationController
def search
Customer.find(customer_params)
end
private
def customer_params
params.require(:customer).permit(:id, :name)
end
@alvadorn
alvadorn / pilha.c
Last active December 3, 2017 03:05
struct pilha_ {
int *dados;
int capacidade;
int tamanho;
};
typedef struct pilha_ Pilha;
Pilha *criaPilha(int capacidade) {
Pilha *pilha = (Pilha *) malloc(sizeof(Pilha));
@alvadorn
alvadorn / DonatorController.java
Created October 21, 2017 01:05
API Donator with Example search
// ... code
public class DonatorController {
@Autowired
private DonatorRepository repository;
// .. code
@RequestMapping(value="/search", method=RequestMethod.GET)
public ResponseEntity<List<Donator>> search(@RequestBody Donator donator) {
ExampleMatcher matcher = ExampleMatcher.matching()
@alvadorn
alvadorn / application_record.rb
Last active March 19, 2017 13:47 — forked from Emethium/all_the_stuff.rb
Lesson halp
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
end
CREATE TABLE Curso (
cod_curso integer,
desc_curso varchar(255),
PRIMARY KEY(cod_curso)
);
CREATE TABLE Aluno (
matricula varchar(15),
nome varchar(255),
curso integer,
library IEEE;
use IEEE.STD_LOGIC_1164.all;
ENTITY somador4_tb IS
END somador4_tb;
ARCHITECTURE somador_tb OF somador4_tb IS
SIGNAL A1, A2, Y: STD_LOGIC_VECTOR (3 DOWNTO 0);
SIGNAL C : STD_LOGIC;
BEGIN