Skip to content

Instantly share code, notes, and snippets.

View gmodarelli's full-sized avatar

Giuseppe Modarelli gmodarelli

View GitHub Profile
@gmodarelli
gmodarelli / setup.sh
Created November 2, 2016 16:12 — forked from Gazler/setup.sh
sysctl -w fs.file-max=12000500
sysctl -w fs.nr_open=20000500
ulimit -n 4000000
sysctl -w net.ipv4.tcp_mem='10000000 10000000 10000000'
sysctl -w net.ipv4.tcp_rmem='1024 4096 16384'
sysctl -w net.ipv4.tcp_wmem='1024 4096 16384'
sysctl -w net.core.rmem_max=16384
sysctl -w net.core.wmem_max=16384
wget http://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb
sudo dpkg -i erlang-solutions_1.0_all.deb
@gmodarelli
gmodarelli / config.ex
Last active March 31, 2018 20:30 — forked from bitwalker/config.ex
Useful config wrapper for Elixir
defmodule Config do
@moduledoc """
This module handles fetching values from the config with some additional niceties
"""
@doc """
Fetches a value from the config, or from the environment if {:system, "VAR"}
is provided.
An optional default value can be provided if desired.
@gmodarelli
gmodarelli / delay.xml
Created February 19, 2015 15:38
MongooseIM contribution
<x xmlns='jabber:x:delay' from='capulet.com' stamp='20020910T23:08:25'>Offline Storage</x>
@gmodarelli
gmodarelli / pre-commit
Last active December 7, 2021 11:20
RuboCop with git pre-commit
#!/bin/sh
#
# Check for ruby style errors
red='\033[0;31m'
green='\033[0;32m'
yellow='\033[0;33m'
NC='\033[0m'
if git rev-parse --verify HEAD >/dev/null 2>&1
@gmodarelli
gmodarelli / image.html
Last active August 29, 2015 14:15
AngularJS Promises
<div ng-controller="ImageCtrl">
<div class="ddarea" ng-file-drop="onFileDropped($files)" ng-file-drag-over-class="dropping">
<p>Drag & Drop your design image here</p>
</div>
<div class="layers">
<div class="layer" ng-class="{ active : layer.active }" ng-repeat="layer in layers">
<div style="background-image: url({{layer.thumb}})"></div>
<a ng-click="removeLayer(layer)">Remove</a>
</div>
@gmodarelli
gmodarelli / .env
Last active August 29, 2015 14:14
ESC #1: Dotenv
MY_SECRET_ID=jkdsa89jkldas8y9p21bjl
MY_SECRET_TOKEN=jdskalhiop12jldaskd
@gmodarelli
gmodarelli / category.rb
Last active August 29, 2015 14:14
Migrating from a 1-to-many association to a many-to-many association
class Category < ActiveRecord::Base
# Old association
belongs_to :topic
# New association
has_and_belongs_to_many :topics
end
@gmodarelli
gmodarelli / default_value.rb
Last active August 29, 2015 14:08
Source Code Reading
define_method(abbr) { |date = nil| DatePart.new(abbr, date) }
var request = require('supertest'),
should = require('should'),
app = require('../server');
var Cookies;
describe('Functional Test <Sessions>:', function () {
it('should create user session for valid user', function (done) {
request(app)
.post('/v1/sessions')
@gmodarelli
gmodarelli / Gemfile
Last active August 29, 2015 14:00
XML2JSON
gem 'xml2json', git: 'git@github.com:monksoftware/xml2json.git'