Skip to content

Instantly share code, notes, and snippets.

View ympons's full-sized avatar
🚀
-> 🆓| 🇨🇺| 👨‍💻

Yaismel Miranda ympons

🚀
-> 🆓| 🇨🇺| 👨‍💻
View GitHub Profile
@ympons
ympons / rust-brainfuck.rs
Created September 23, 2015 06:46
Rust-Brainfuck implementation!!
//@ympons
trait Runnable {
fn run(&mut self);
}
struct Engine {
source: Vec<char>,
ip: usize,
tape: Vec<u8>,
p: usize,
@ympons
ympons / reverse.go
Last active March 8, 2016 06:06
Reverse Linked List
//@ympons
// Reverse Linked List
package main
import "fmt"
type Node struct {
value int
next *Node
}
@ympons
ympons / recursive_reverse.go
Created March 14, 2016 03:07
Reverse Single Linked List
//@ympons - https://play.golang.org/p/mNEabcyTVa
package main
import "fmt"
type Node struct {
data int
next *Node
}
@ympons
ympons / palindrome_char.c
Created August 2, 2016 21:09
Check if the bits in a char are a palindrome
#include <stdio.h>
#include <limits.h>
int isPalind(char c) {
int a[CHAR_BIT];
for(int i=0;i<CHAR_BIT;i++) {
a[i] = (c >> i) & 1;
}
for (int i=0;i<5;i++) {
if (a[i] != a[7-i]) {
@ympons
ympons / max_subarray.c
Created August 3, 2016 04:57
Find Max SubArray with given sum
#include <stdio.h>
int maxLength(int a_size, int* a, int k) {
int sum = a[0], i, ini=0, sol=0, s;
for (i=1;i<a_size;i++) {
sum += a[i];
while(sum > k && ini < i) {
sum -= a[ini];
ini++;
}
@ympons
ympons / README.md
Created October 28, 2016 03:31 — forked from joakimk/README.md
CircleCI elixir build example

This runs a build for a small elixir (phoenix) project in about 40 seconds by caching as much of the compiled files as possible.

We've been using this for months in multiple projects without any issues. Please ping be if there is any issues with this script and I'll update it.

It should be generic enough to work on any elixir app using mix.

If you have a elixir_buildpack.config, then enable that section in the build script to keep versions in sync!

2016-08-09: Updated to newer Erlang and Elixir and fixed curl command.

@ympons
ympons / aws_initial.png
Last active November 8, 2016 21:46
Starting with AWS
aws_initial.png
@ympons
ympons / quicksort.ex
Created January 30, 2017 07:04
Simple QuickSort implementation in Elixir
defmodule QuickSort do
def sort([]), do: []
def sort([head|tail]) do
{l, r} = Enum.partition(tail, &(&1 > head))
sort(l) ++ [head] ++ sort(r)
end
end
a = QuickSort.sort([3, 1, 2, 5])
IO.inspect a
@ympons
ympons / install-elixir-prod-ready.sh
Last active February 7, 2017 18:27
Install Elixir on Ubuntu box (Ubuntu 12.04/14.04/16.04)
#!/bin/bash
# Install Erlang & Elixir on Ubuntu box (production ready)
# Install erlang and elixir
wget https://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb && sudo dpkg -i erlang-solutions_1.0_all.deb
sudo apt-get update -y
sudo apt-get install -y esl-erlang elixir erlang
# Install git and nginx
sudo apt-get install -y git nginx
@ympons
ympons / quicksort1.go
Created March 2, 2017 01:20
Simple QuickSort implementation in Golang #1
package main
import (
"fmt"
"sort"
)
func quicksort(a sort.Interface, i, j int) {
if j > i {
left, right := i, j