Skip to content

Instantly share code, notes, and snippets.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE keyboard PUBLIC "" "file://localhost/System/Library/DTDs/KeyboardLayout.dtd">
<!--Last edited by Ukelele version 2.0.1 on 2010-08-26 at 17:40 (GMT+02:00)-->
<keyboard group="0" id="2" name="U.S. International w/o dead keys" maxout="1">
<layouts>
<layout first="0" last="17" modifiers="f4" mapSet="16c"/>
<layout first="18" last="18" modifiers="f4" mapSet="994"/>
<layout first="21" last="23" modifiers="f4" mapSet="994"/>
<layout first="30" last="30" modifiers="f4" mapSet="994"/>
<layout first="194" last="194" modifiers="f4" mapSet="994"/>
@Endika
Endika / .bashrc
Last active November 2, 2017 23:07
Automatic cd ..
rcd(){
builtin cd ..
NUM=${@:-1}
if [ $NUM -gt 1 ]
then
COUNT=$NUM
let "COUNT--"
rcd $COUNT
fi
}
#!/bin/bash -e
user=$(whoami)
fl=$(find /proc -maxdepth 2 -user $user -name environ -print -quit)
for i in {1..5}
do
fl=$(find /proc -maxdepth 2 -user $user -name environ -newer "$fl" -print -quit)
done
export DBUS_SESSION_BUS_ADDRESS=$(grep -z DBUS_SESSION_BUS_ADDRESS "$fl" | cut -d= -f2-)
@Endika
Endika / genome_simple.sh
Created March 17, 2017 09:21
Simple alias to search in UCSC
#!/bin/bash
# Include in your ~/.bash_aliases
function search_genome(){
mysql --user=genome --host=genome-mysql.cse.ucsc.edu -A hg38 --execute="select kg.chrom, kg.strand, kg.txStart, kg.txEnd, kg.exonCount, kg.proteinID, kgp.seq from knownGene as kg inner join knownGenePep as kgp on kg.name=kgp.name where chrom=\"$1\" and txStart>=$2 limit $3;"
}
alias genomeSearch=search_genome
# How to run
@Endika
Endika / bash_aliases.sh
Last active February 28, 2017 11:34
tsuru alias
alias tsuruprod='tsuru target-set prod | echo "MyProdPass" | tsuru login eiglesias@hostname.com'
alias tsurudev='tsuru target-set dev | echo "MyDevPass" | tsuru login eiglesias@hostname.com'
tsuru_cmd(){
if [ $2 ]; then
$1 $2
else
$1 $(python -c "import sys;print(sys.prefix.split(\"/\")[-1])")
fi
}
alias tsurudeploy='tsuru_cmd "tsuru app-deploy . -a "'
# How to get the Angular Song in mp3
ffmpeg -i AngularJSsong.mp4 -f mp3 angular.mp3
@Endika
Endika / regular_expression
Last active November 12, 2016 08:47
regular_expression note
search and replace
:%s/Hola/Adíos
Search and replace ALL
:%s/Hola/Adiós/g
Replace lineNumber for the number of line.
:%s/lineNumber/\=line('.')/g
Search lineNumber and replace to index var.
:let index=0 | g/lineNumber/s//\=index./ |let index=index+1
@Endika
Endika / Rnote.r
Last active September 23, 2016 21:24
R note
# Run command line
R
# How to install new packages
install.packages("PackageName")
# How to import packages
library(packageName)
# Clear enviroment
rm(list=ls())
@Endika
Endika / python_decorators.py
Created July 14, 2016 09:58
Lazy decorators
import datetime
def bucle(loop=1, debug=False):
"""Simple decorator only use to repeat func."""
def bucle_decorator(func):
def func_wrapper(*args, **kwargs):
c = loop
i = 0
while c > 0:
start = False
if debug:
@Endika
Endika / basic_vi.sh
Last active May 25, 2016 09:37
[DUMMIES] Basic Vi comand and config
.##.....##.####
.##.....##..##.
.##.....##..##.
.##.....##..##.
..##...##...##.
...##.##....##.
....###....####
.########..#######..########.
.##.......##.....##.##.....##
.##.......##.....##.##.....##