Skip to content

Instantly share code, notes, and snippets.

View marioidival's full-sized avatar
😶‍🌫️

Mario Idival marioidival

😶‍🌫️
  • Self Employed ;)
  • Campina Grande, Paraíba, Brazil
  • 02:52 (UTC -03:00)
  • X @marioidival
View GitHub Profile
@marioidival
marioidival / heap_array.java
Last active March 13, 2018 13:11
Aula Estrutura de dados, 13 March, 2018
import java.lang.Object;
import java.util.ArrayList;
// TODO: implement EPilhaVazia, EPilhaCheia
// TODO: use cap attribute
public class HelloWorld
{
public static void main(String[] args)
{
QueueArray qe = new QueueArray(5);
qe.push("Oi");
@marioidival
marioidival / README.md
Created February 19, 2018 14:36 — forked from bruth/README.md
Postgres push notification

Postgres push triggers

Watch a table for changes and push a notification with a payload describing the change.

Example

In the Postgres shell:

-- Create the functions
@marioidival
marioidival / rochacbruno_open_source.md
Created January 11, 2018 18:25 — forked from rochacbruno/rochacbruno_open_source.md
Contribute to Open Source Projects

Quick Tips for Fast Code on the JVM

I was talking to a coworker recently about general techniques that almost always form the core of any effort to write very fast, down-to-the-metal hot path code on the JVM, and they pointed out that there really isn't a particularly good place to go for this information. It occurred to me that, really, I had more or less picked up all of it by word of mouth and experience, and there just aren't any good reference sources on the topic. So… here's my word of mouth.

This is by no means a comprehensive gist. It's also important to understand that the techniques that I outline in here are not 100% absolute either. Performance on the JVM is an incredibly complicated subject, and while there are rules that almost always hold true, the "almost" remains very salient. Also, for many or even most applications, there will be other techniques that I'm not mentioning which will have a greater impact. JMH, Java Flight Recorder, and a good profiler are your very best friend! Mea

Backup:
docker exec -t -u postgres your-db-container pg_dumpall -c > dump_`date +%d-%m-%Y"_"%H_%M_%S`.sql
Restore:
cat your_dump.sql | docker exec -i your-db-container psql -Upostgres
@marioidival
marioidival / main.rs
Created October 26, 2017 11:20 — forked from steveklabnik/main.rs
The Results of the Expressive C++17 Coding Challenge in Rust
use std::env;
use std::io;
use std::io::prelude::*;
use std::fs::File;
#[derive(Debug)]
enum Error {
Io(io::Error),
Program(&'static str),
}
@marioidival
marioidival / main.rs
Created October 3, 2017 11:46 — forked from meqif/main.rs
use std::thread;
use std::sync::{Arc, RwLock};
// Represents a reference to a node.
// This makes the code less repetitive to write and easier to read.
type NodeRef<T> = Arc<RwLock<_Node<T>>>;
// The private representation of a node.
struct _Node<T> {
inner_value: T,
noremap hh <esc>
nnoremap ; :
nnoremap : ;
noremap <up> :echoerr 'use k to up'<CR>
noremap <down> :echoerr 'use j to down'<CR>
noremap <left> :echoerr 'use h to left'<CR>
noremap <right> :echoerr 'use l to right'<CR>
inoremap <up> <ESC>:echoerr 'use k to up'<CR>
@marioidival
marioidival / issues.json
Created August 8, 2017 10:05
Issues from old repo
[
{
"url": "https://api.github.com/repos/rust-br/rust-book-pt-br/issues/29",
"repository_url": "https://api.github.com/repos/rust-br/rust-book-pt-br",
"labels_url": "https://api.github.com/repos/rust-br/rust-book-pt-br/issues/29/labels{/name}",
"comments_url": "https://api.github.com/repos/rust-br/rust-book-pt-br/issues/29/comments",
"events_url": "https://api.github.com/repos/rust-br/rust-book-pt-br/issues/29/events",
"html_url": "https://github.com/rust-br/rust-book-pt-br/pull/29",
"id": 248573241,
"number": 29,