Skip to content

Instantly share code, notes, and snippets.

View rhaseven7h's full-sized avatar
🙊

Gabriel Medina rhaseven7h

🙊
View GitHub Profile
#include "IRremote.h"
#include <SoftwareSerial.h>
#define REL_SIGNAL 5
#define IR_POLL_DELAY 50
#define WIFI_MODULE_RX 3
#define WIFI_MODULE_TX 2
bool lampOn = false;
int receiver = 11;
void handleSerialComms() {
while (Serial1.available()) {
char inByte = Serial1.read();
Serial.write(inByte);
}
while (Serial.available()) {
int inByte = Serial.read();
Serial1.write(inByte);
}
}
@rhaseven7h
rhaseven7h / Dockerfile
Created December 9, 2017 08:10
Dockerfile for Ruby + MySQL Client + Bundler & SQLite3 Gems
FROM ubuntu:16.04
RUN apt-get update && \
apt-get install -y \
build-essential \
zlib1g-dev \
libreadline-dev \
libssl-dev \
libffi-dev \
libncurses-dev \
@rhaseven7h
rhaseven7h / Mac SSH Autocomplete
Created September 13, 2017 05:46 — forked from aliang/Mac SSH Autocomplete
Add auto complete to your ssh, put into your .bash_profile
_complete_ssh_hosts ()
{
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
comp_ssh_hosts=`cat ~/.ssh/known_hosts | \
cut -f 1 -d ' ' | \
sed -e s/,.*//g | \
grep -v ^# | \
uniq | \
grep -v "\[" ;
@rhaseven7h
rhaseven7h / kube-registry.yaml
Created September 7, 2017 02:55 — forked from coco98/kube-registry.yaml
Docker registry on minikube
apiVersion: v1
kind: ReplicationController
metadata:
name: kube-registry-v0
namespace: kube-system
labels:
k8s-app: kube-registry
version: v0
spec:
replicas: 1
@rhaseven7h
rhaseven7h / main.go
Created May 31, 2017 09:27
Golang PayPal Quick And Dirty Shopping Cart Upload and Payment Execution
package main
import (
"encoding/json"
"fmt"
"log"
"os"
"strings"
"github.com/logpacker/PayPal-Go-SDK"
@rhaseven7h
rhaseven7h / main.go
Created May 24, 2017 18:38
Crop and Resize a Directory with Images with Golang (Go)
package main
import (
"fmt"
"log"
"path/filepath"
"github.com/disintegration/imaging"
)
@rhaseven7h
rhaseven7h / README.md
Created July 29, 2016 01:20
HackerRank.com - Functional Programming - Haskell - String Compression

String Compression

Joseph and Jane are making a contest for apes. During the process, they have to communicate frequently with each other. Since they are not completely human, they cannot speak properly. They have to transfer messages using postcards of small sizes. To save space on the small postcards, they devise a string compression algorithm:

  • If a character, ch, occurs n (>1) times in a row, then it will be represented by {ch}{n}, where {n} is the value of n. For example, if the substring is a sequence of 'a' ("aaaa"), it will be represented as "a4".
  • If a character, ch, occurs exactly one time in a row, then it will be simply represented as {ch}. For example, if the substring is "a", then it will be represented as "a".

Help Joseph to compress a message, msg.

@rhaseven7h
rhaseven7h / README.md
Created July 29, 2016 01:03
HackerRank.com - Functional Programming - Haskell - Concave Polygon

Concave Polygon

You are given the cartesian coordinates of a set of points in a 2D plane (in no particular order). Each of these points is a corner point of some Polygon, P, which is not self-intersecting in nature. Can you determine whether or not is a concave polygon?

Input Format

The first line contains an integer, N, denoting the number of points. The N subsequent lines each contain 2 space-separated integers denoting the respective x and y coordinates of a point.

Constraints

@rhaseven7h
rhaseven7h / PS1.sh
Created July 28, 2016 08:23
PS1 Setup with nvm and git branch
export PS1="┏ \[$(tput bold)\]\[$(tput setaf 2)\]\u\[$(tput setaf 7)\]\[$(tput bold)\]@\[$(tput setaf 6)\]\H \[$(tput setaf 3)\][\w]\[$(tput sgr0)\]\n┃ \[$(tput bold)\]\[$(tput setaf 7)\]\d :: \t :: nvm=\$(nvm current) :: branch=\$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo not-a-git-repo) :: Cmd #\!\[$(tput sgr0)\] \n┗ \[$(tput bold)\]\[$(tput setaf 3)\]\\$ \[$(tput sgr0)\]\[$(tput sgr0)\]"