Skip to content

Instantly share code, notes, and snippets.

View eksperimental's full-sized avatar

Eksperimental eksperimental

  • Available for hire
  • Remote
View GitHub Profile
//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Created: 2010/12/05
// Updated: 2018/09/12
// License: MIT
//
// Copyright (c) 2010-2018 Diego Perini (http://www.iport.it)
//
@jasonrudolph
jasonrudolph / git-branches-by-commit-date.sh
Created February 12, 2012 20:40
List remote Git branches and the last commit date for each branch. Sort by most recent commit date.
# Credit http://stackoverflow.com/a/2514279
for branch in `git branch -r | grep -v HEAD`;do echo -e `git show --format="%ci %cr" $branch | head -n 1` \\t$branch; done | sort -r
@juanje
juanje / Description.md
Last active November 30, 2023 19:29
Limit Chrome from eating all the memory and CPU

I was tired of Chrome eating all my laptop resources so I decided to put some limit to it with cgroup.

As I was using Ubuntu 12.04 with support for cgroup, I installed the package cgroup-bin and add the following group to the file /etc/cgconfig.conf:

group browsers {
    cpu {
#       Set the relative share of CPU resources equal to 25%
        cpu.shares = "256";
 }
@dynamicguy
dynamicguy / .gitconfig
Created June 10, 2014 07:23
~/.gitconfig
# local user config, usernames, etc
[core]
excludesfile=~/.gitignore
[include]
path=~/.gitconfig-local
[color]
diff = auto
status = auto
branch = auto
@nocturnalgeek
nocturnalgeek / MailinatorAliases
Last active April 8, 2024 20:45
A list of alternate domains that point to @mailinator.com
@binkmail.com
@bobmail.info
@chammy.info
@devnullmail.com
@letthemeatspam.com
@mailinater.com
@mailinator.net
@mailinator2.com
@notmailinator.com
@reallymymail.com
@jcomellas
jcomellas / gist:732cb5ddacb1ccdfa349
Created May 21, 2015 11:44
Elixir tuple map function
# Map over a tuple in normal order
def tuple_map1(tuple, function), do:
tuple_map(tuple, function, 0, [])
def tuple_map1(tuple, function, index, acc) when index < tuple_size(tuple) do
item = function.(elem(tuple, index))
tuple_map1(tuple, function, index + 1, [item | acc])
end
def tuple_map1(tuple, function, index, acc) do
Enum.reverse(acc)
@eksperimental
eksperimental / check_not_linked_exdoc.sh
Last active September 4, 2015 03:02
Check for references to exiting modules in the documentation, that is actually not being liked by ExDoc, in the documentation for the Elixir project
#!/bin/bash
# ./check_not_linked_exdoc.sh – http://git.io/check_not_linked_exdoc.sh
#
# Description:
# Check for references to exiting modules in the documentation, that is actually not being liked
# by ExDoc.
#
# Instructions
# Run from the root folder in the elixir project – https://github.com/elixir-lang/elixir/
@eksperimental
eksperimental / .bash_funcs
Last active April 4, 2021 00:48
ag-l1 : ag – searches files and list them with the line of the first match. Useful to combine with with xargs and your favorite text editor.
#######################################################################
# `ag` list file with first match line number
# Returns a list of files including the first line matched in the file
# emulates the non-implemented option: `ag --files-with-matches-line-number`
# for `ag` (the silver searcher) https://github.com/ggreer/the_silver_searcher
# feature request: https://github.com/ggreer/the_silver_searcher/issues/715
# Usage: just simple use it as you would use `ag -l`, but ommit the -l option
# $ ag-l1 "(pattern)?.*"
# Installation: add this function to your ~/.bash_funcs file
# Download: https://git.io/ag-l1
@eksperimental
eksperimental / make-test-file
Last active November 10, 2015 17:05
A script to ease development of the Elixir programming code base. Allowing the developer to run selected tests.
#!/bin/sh
# make-test-file
# https://git.io/make-test-file
#
# DESCRIPTION:
# make-test-file is a script to ease development of the Elixir programming code
# base. Allowing the developer to run selected tests.
#
# INTRODUCTION:
defmodule ForLoop do
@doc ~S"""
Iterates over `term`, while `condition` between `term` and `final` is truthy,
applying `fun`. It returns the accumulated terms.
- `term` is any that will be iterated over.
- `final_term` is the element that will be run against `term` in `condition`.
- `condition` can take 1 argument: `term`, or two arguments: `term` and `final`.
- `fun` is run every time a `condition` is evaluated to truthy.
- `transform` is applied to `term` at the end of every loop, before the next iteration.