Skip to content

Instantly share code, notes, and snippets.

View feliperohdee's full-sized avatar
🚀
Going High

Felipe Rohde feliperohdee

🚀
Going High
View GitHub Profile
#!/bin/bash
### BEGIN INIT INFO
# Provides: disable-transparent-hugepages
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Disable Linux transparent huge pages
# Description: Disable Linux transparent huge pages, to improve
# database performance.
### END INIT INFO
@feliperohdee
feliperohdee / install-redis.sh
Created May 25, 2018 15:09 — forked from khelll/install-redis.sh
Installing Redis on Amazon Linux
#!/bin/bash
###############################################
# To use:
# chmod +x install-redis.sh
# ./install-redis.sh
###############################################
version=3.2.0
echo "*****************************************"
echo " 1. Prerequisites: Install updates, set time zones, install GCC and make"
{
"beautify.config": {
"js": {
"e4x": true
},
"css": {
"selector_separator_newline": true,
"newline_between_rules": true,
"preserve_newlines": true,
"end_with_newline": true
package main
import (
"bytes"
"encoding/base64"
"errors"
"github.com/aws/aws-lambda-go/lambda"
"github.com/disintegration/imaging"
"github.com/nickalie/go-webpbin"
"io/ioutil"
@feliperohdee
feliperohdee / GraphQLMux.js
Last active January 31, 2018 12:18
Multiplex many GraphQL requests
/*
Usage:
const http = json => fetch('http://yourGraphQLEndpoint.com', {
method: 'POST',
cache: 'no-store',
headers: {
'content-type': 'application/json'
},
body: JSON.stringify(json)
@feliperohdee
feliperohdee / Events.js
Created January 24, 2018 19:23
cool events
import filter from 'lodash/filter';
import forEach from 'lodash/forEach';
import isFunction from 'lodash/isFunction';
import isString from 'lodash/isString';
export default class Events {
constructor(persist) {
this._fns = [];
}
@feliperohdee
feliperohdee / getSet.js
Created January 21, 2018 20:11
safe get/set properties
export function get(fn, defaultValue = null, args) {
try {
const result = fn(args);
return result !== undefined && result !== null ? result : defaultValue;
} catch (e) {
return defaultValue;
}
}
@feliperohdee
feliperohdee / object.js
Last active November 30, 2017 13:01
Safe object manipulators and observable pattern store
// safe object getter setter
// get({}, ['prop1', 'prop2], [])
// set({}, ['prop1', 'prop2], [])
const isString = path => typeof path === 'string';
export function get(object, path, defaultValue = null) {
const string = isString(path);
const length = path.length;
@feliperohdee
feliperohdee / geometry.js
Last active September 2, 2017 17:21
Set of useful analytic geometry equations I usually use
import _ from 'lodash';
export const degToRad = x => {
return x / 180 * Math.PI;
};
export const radToDeg = x => {
return x / Math.PI * 180;
};
@feliperohdee
feliperohdee / md.js
Created June 21, 2017 23:51
lightweight MD like parser
const regex = {
headline: /^(#{1,6})([^#\n]+)$/m,
hr: /^(?:([*\-_] ?)+)\1\1$/gm,
style: /(?:([*_~]{1,3}))([^*_~\n]+[^*_~\s])\1/g
};
export default function(str) {
let stra;
/* headlines */