Skip to content

Instantly share code, notes, and snippets.

@dlfinis
dlfinis / inputrc
Created May 11, 2021 15:41 — forked from snipe/inputrc
~/.inputrc for nice bash history up-arrows. This allows you to search through your history using the up and down arrows … i.e. type "cd /" and press the up arrow and you'll search through everything in your history that starts with "cd /". Create ~/.inputrc and fill it with this:
"\e[A": history-search-backward
"\e[B": history-search-forward
set show-all-if-ambiguous on
set completion-ignore-case on
@dlfinis
dlfinis / tailf.sh
Created March 25, 2019 16:34
Complete read of a file with tail and color
#!/bin/sh
tail -f ${@:1} | sed --unbuffered \
-e 's/\(.*INFO.*\)/\o033[90m\1\o033[39m/' \
-e 's/\(.*NOTICE.*\)/\o033[37m\1\o033[39m/' \
-e 's/\(.*WARNING.*\)/\o033[33m\1\o033[39m/' \
@dlfinis
dlfinis / tailc.sh
Created March 25, 2019 16:33
Tail with color
#!/bin/sh
tail ${@:1} | sed --unbuffered \
-e 's/\(.*FATAL.*\)/\o033[1;31m\1\o033[0;39m/' \
-e 's/\(.*ERROR.*\)/\o033[31m\1\o033[39m/' \
-e 's/\(.*Hibernate*\)/\o033[35m\1\o033[39m/' \
-e 's/\(.*WARN.*\)/\o033[36m\1\o033[39m/' \
-e 's/\(.*INFO.*\)/\o033[32m\1\o033[39m/' \
-e 's/\(.*DEBUG.*\)/\o033[34m\1\o033[39m/' \
@dlfinis
dlfinis / clean_audio.sh
Created March 24, 2017 16:44 — forked from devoncrouse/clean_audio.sh
Using Sox (http://sox.sourceforge.net) to remove background noise and/or silence from audio files (individually, or in batch).
# Create background noise profile from mp3
/usr/bin/sox noise.mp3 -n noiseprof noise.prof
# Remove noise from mp3 using profile
/usr/bin/sox input.mp3 output.mp3 noisered noise.prof 0.21
# Remove silence from mp3
/usr/bin/sox input.mp3 output.mp3 silence -l 1 0.3 5% -1 2.0 5%
# Remove noise and silence in a single command
@dlfinis
dlfinis / noise.sh
Created March 23, 2017 21:23 — forked from rsvp/noise.sh
noise : relaxing ambient Brown noise generator (cf. white noise) | Linux bash script using sox | CogSci notes
#!/usr/bin/env bash
# bash 4.1.5(1) Linux Ubuntu 10.04 Date : 2011-10-04
#
# _______________| noise : ambient Brown noise generator (cf. white noise).
#
# Usage: noise [minutes=59] [band-pass freq center=1786] [wave]
# ^minutes can be any positive integer.
# Command "noise 1" will display peak-level meter.
#
# Dependencies: play (from sox package)
@dlfinis
dlfinis / .eslintrc.yaml
Created January 31, 2017 22:33
Strict ESLint config for React, ES6 (based on Airbnb Code style) YAML Format
parser: babel-eslint
env:
browser: true
node: true
es6: true
ecmaFeactures:
arrowFunctions: true
binaryLiterals: true
blockBindings: true
classes: true
## Atom Editor
## Master configuration of the Editor based in the user dlfinis
@dlfinis
dlfinis / examples-sed
Last active March 3, 2024 04:01
Examples of Sed' Use
The syntax of sed command replacement is:
$ sed 's/find/replace/' file
This sed command finds the pattern and replaces with another pattern. When the replace is left empty, the pattern/element found gets deleted.
Let us consider a sample file as below:
$ cat file
Linux
@dlfinis
dlfinis / select-article-liferay-ajax
Created June 3, 2015 21:26
Change event of select menu by ajax laod the article content in a part of the page
$(function() {
$( "#listImages" )
.selectmenu();
$(""#listImages").on('selectmenuchange',function() {
var articleId=$(this).val();
var groupId= <%=themeDisplay.getScopeGroupId() %>;
var url= '<liferay-portlet:renderURL windowState="exclusive" portletName="56_INSTANCE_cam"> '+
'<liferay-portlet:param name="groupId" value="ScopeGroupID" />'+
#############################################
# Push de la rama actual
git push origin $rama_actual
#############################################
# Volver a un commit anterior, descartando los cambios
git reset --HARD $SHA1
#############################################
# Ver y descargar Ramas remotas