Skip to content

Instantly share code, notes, and snippets.

Avatar

Giuseppe Modarelli gmodarelli

View GitHub Profile
View 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 Mar 31, 2018 — forked from bitwalker/config.ex
Useful config wrapper for Elixir
View config.ex
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 Feb 19, 2015
MongooseIM contribution
View delay.xml
<x xmlns='jabber:x:delay' from='capulet.com' stamp='20020910T23:08:25'>Offline Storage</x>
@gmodarelli
gmodarelli / pre-commit
Last active Jun 15, 2021
RuboCop with git pre-commit
View 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 Aug 29, 2015
AngularJS Promises
View image.html
<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 Aug 29, 2015
ESC #1: Dotenv
View .env
MY_SECRET_ID=jkdsa89jkldas8y9p21bjl
MY_SECRET_TOKEN=jdskalhiop12jldaskd
@gmodarelli
gmodarelli / category.rb
Last active Aug 29, 2015
Migrating from a 1-to-many association to a many-to-many association
View category.rb
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 Aug 29, 2015
Source Code Reading
View default_value.rb
define_method(abbr) { |date = nil| DatePart.new(abbr, date) }
View login.test.js
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')
View Gemfile
gem 'xml2json', git: 'git@github.com:monksoftware/xml2json.git'