Skip to content

Instantly share code, notes, and snippets.

View jonathanpmartins's full-sized avatar
🏠
Working from home

Jonathan Prass Martins jonathanpmartins

🏠
Working from home
View GitHub Profile
@onyxraven
onyxraven / rds.sh
Last active June 21, 2022 13:42 — forked from douglasjarquin/gist:2208690
Amazon RDS Performance Tuning Settings
#XLarge DBInstanceClassMemory = 15892177440 = 14.8GB
#/32 = 496630545 = 473MB
#/64 = 248315272 = 236MB
#/128 = 124157636 = 118MB
#/256 = 62078818 = 59MB
#/512 = 31039409 = 29MB
#/12582880 = 1263 #default same divisor as max_connections = 4041.6MB = 4237924762
#/25165760 = 623 # half of max_connections = 1993.6MB
#/50331520 = 315 # quarter of max_connections = 1008MB = 1056964608
#*(3/4) #default innodb pool size = 11922309120
@dweldon
dweldon / meteor-nginx
Last active January 22, 2024 06:53
This is an example of how to configure nginx to serve a meteor app.
server {
listen [::]:80;
listen 80;
server_name app.example.com;
return 301 https://$server_name$request_uri;
}
server {
@lukaswhite
lukaswhite / ClearBeanstalkdQueueCommand.php
Last active March 20, 2023 08:11
Clear a Beanstalkd Queue in Laravel
<?php
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
class ClearBeanstalkdQueueCommand extends Command {
/**
@cristianobecker
cristianobecker / cpf.js
Last active April 26, 2016 17:17
Validar CPF por javascript
var CPF = (function () {
var eleven = 11;
function mod(n) {
var t = eleven,
a = n % t;
return (a < 2 ? 0 : t - n % t) + '';
}
@cristianobecker
cristianobecker / type.js
Created October 17, 2014 19:24
Get the type of any object in JavaScript
function type(e) {
var t = Object.prototype.toString.call(e),
r = /\[object (\w+)\]/i.exec(t);
return r && r[1].toLowerCase();
}
[1,"2", true, null, [], {}, function() {}, undefined].forEach(function(e){
console.log(type(e))
});
@johnhout
johnhout / setup_laravel.sh
Last active September 4, 2015 16:32
Laravel 5 quick install bash!
#!/bin/sh
# Laravel 5 new project setup bash script.
# Inspired by Mitchell van Wijngaarden
# Extended by John in 't Hout
projectname=$1
git clone -o laravel -b develop https://github.com/laravel/laravel.git ${projectname} >/dev/null
cd ${projectname}
git checkout --orphan master
{
"title": "collectd-post",
"services": {
"query": {
"list": {
"0": {
"query": "plugin: \"cpu\" AND plugin_instance: \"0\"",
"alias": "cpu1",
"color": "#7EB26D",
"id": 0,
@cristianobecker
cristianobecker / search-files.sh
Last active December 30, 2016 04:24
Fast way to search in files in small projects
search-files() {
local folder=$(test $# -eq 2 && echo "$1" || echo .)
local query=$(test $# -eq 2 && echo "$2" || echo "$1")
local IFS=$'\n'
for f in $(find "$folder" -type f); do
local result=$(
cat "$f" |
GREP_COLOR='01;32' egrep --color=always -n "$query" |
GREP_COLOR='01;33' egrep --color=always "^\d+:"
@rbarilani
rbarilani / subsetSum.js
Created September 12, 2015 20:07
Finding all possible combinations of numbers to reach a given sum ()
function subsetSum(numbers, target, partial) {
var s, n, remaining;
partial = partial || [];
// sum partial
s = partial.reduce(function (a, b) {
return a + b;
}, 0);
@tiagoad
tiagoad / block-tor.sh
Created July 21, 2016 10:40
Cronjob to block tor exit nodes with nginx on debian 8 jessie
wget -qO- https://check.torproject.org/exit-addresses | grep ExitAddress | cut -d ' ' -f 2 | sed "s/^/deny /g; s/$/;/g" > /etc/nginx/conf.d/tor-block.conf; systemctl reload nginx