Skip to content

Instantly share code, notes, and snippets.

View grevych's full-sized avatar
🤓

Gerardo Reyes grevych

🤓
View GitHub Profile
@grevych
grevych / Mindstorm.java
Created January 27, 2015 15:20
LEJOS NXJ first lab
import lejos.nxt.Button;
import lejos.nxt.Motor;
import lejos.nxt.SensorPort;
import lejos.nxt.Sound;
import lejos.nxt.TouchSensor;
import lejos.robotics.navigation.DifferentialPilot;
@grevych
grevych / reverse_list.c
Last active November 2, 2016 21:52
Reverse a linked list without iteration constructors, just recursion and no more than one argument, no global variables allowed.
Node *reverse_list(Node *node) {
if(node->next->next == NULL) {
node->next->next = node;
return node->next;
}
else {
return (reverse_list(node->next) + 0 *(node->next->next = node) + 0 *(node->next = NULL))
}
}
@grevych
grevych / anagrams.py
Last active November 2, 2016 21:53
Group by anagrams a list of words
#!/usr/bin/env python
words = [
"AMOR",
"ARMO",
"ESPONJA",
"JAMON",
"JAPONES",
"MARO",
"MONJA",
@grevych
grevych / parenthesis.py
Created November 2, 2016 21:29
Invert strings inside parenthesis
#!/usr/bin/env python
def init_stack(stack):
main = []
stack.append(main)
return main
def reverse_inside(input):
stacks = []
main = init_stack(stacks)
@grevych
grevych / polish_notation.py
Created November 2, 2016 22:35
Function that solves an arithmetic expression given in polish notation
#!/usr/bin/env python
def solve(polish_notation):
polish_notation = polish_notation.split()
elements = []
operations = {
'+': lambda x, y: x + y,
'-': lambda x, y: x - y,
'*': lambda x, y: x * y,
@grevych
grevych / new_relic_monitoring_report.js
Last active July 13, 2017 19:52
New Relic daily monitoring report
#!/usr/bin/env node
const request = require('request-promise');
const argparse = require('argparse');
const sprintf = require('sprintf');
const NEW_RELIC_API_KEY_ENVIRONMENT_VARIABLE = 'NEW_RELIC_API_KEY'
const NEW_RELIC_PARTNER_ID_ENVIRONMENT_VARIABLE = 'NEW_RELIC_PARTNER_ID'
const NEW_RELIC_ACCOUNT_ID_ENVIRONMENT_VARIABLE = 'NEW_RELIC_ACCOUNT_ID'
@grevych
grevych / requests_analyzer.py
Created April 5, 2017 18:07
MPP internal tools
#!/usr/bin/env python
import os
import sys
import json
from pprint import pprint
import boto3

Keybase proof

I hereby claim:

  • I am grevych on github.
  • I am grevych (https://keybase.io/grevych) on keybase.
  • I have a public key ASBiFavX5xJ84Tmq0zi0I3HLaGwKDBM5NVR6D178IPTz-Ao

To claim this, I am signing this object:

@grevych
grevych / validate.py
Created November 15, 2017 01:11
Validate JSON files in the current directory
#! /usr/bin/env python
import os
import json
from pprint import pprint
invalid_files = []
valid_files = []
@grevych
grevych / match_intersections.py
Last active January 26, 2018 19:18
From a list of segments merge those that intersect..
#!/bin/env python
def match_intersections(pairs):
stack = []
pairs.sort()
print 'INPUT: ', pairs
print ''
while pairs.__len__() >= 2: