Skip to content

Instantly share code, notes, and snippets.

View U.S. International w-o dead keys.keylayout
<?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"/>
View random-background.sh
#!/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 / .bashrc
Last active Nov 2, 2017
Automatic cd ..
View .bashrc
rcd(){
builtin cd ..
NUM=${@:-1}
if [ $NUM -gt 1 ]
then
COUNT=$NUM
let "COUNT--"
rcd $COUNT
fi
}
@Endika
Endika / genome_simple.sh
Created Mar 17, 2017
Simple alias to search in UCSC
View genome_simple.sh
#!/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
View bash_aliases.sh
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 "'
View mp4_to_mp3.sh
# How to get the Angular Song in mp3
ffmpeg -i AngularJSsong.mp4 -f mp3 angular.mp3
View Rnote.r
# 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 / regular_expression
Last active Nov 12, 2016
regular_expression note
View regular_expression
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
View python_decorators.py
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
[DUMMIES] Basic Vi comand and config
View basic_vi.sh
.##.....##.####
.##.....##..##.
.##.....##..##.
.##.....##..##.
..##...##...##.
...##.##....##.
....###....####
.########..#######..########.
.##.......##.....##.##.....##
.##.......##.....##.##.....##