Programas y/o Comandos

SSH

sshfs root@192.168.69.235 -p 61786 /punto-montaje
rsync -az -e "ssh -p 61786" root@181.75.151.213:/var/www/sistema .
rsync -az --exclude 'nnasunknown/.git' --exclude 'nnasunknown/.mozilla' --exclude 'nnasunknown/.cache' --exclude 'nnasunknown/.thumbnails' --exclude 'nnasunknown/Música' --exclude 'nnasunknown/Descargas' nnasunknown@192.168.69.26:/home/nnasunknown .
ssh root@181.75.151.213 -p61786
sshfs kdeconnect@192.168.69.40:/storage /home/nnasunknown/.kde/share/apps/kdeconnect/a2e6ca391c4fabb0 -p 1739 -d -f -o IdentityFile=/home/nnasunknown/.kde/share/apps/kdeconnect/key.pem -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null
sshfs kdeconnect@192.168.69.40:/ /home/nnasunknown/.kde/share/apps/kdeconnect/a2e6ca391c4fabb0 -p 1739 -d -f -o IdentityFile=/home/nnasunknown/.kde/share/apps/kdeconnect/key.pem -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/nul

Credenciales

ssh-keygen -b 10240 -t rsa -C "Equipo Hadit NnAsUnKnOwn" -f id_rsa-nnasunknown
ssh-copy-id -i id_rsa-nnasunknown.pub root@tecgnus.cl
ssh root@tecgnus.cl -i id_rsa-nnasunknown

ssh-keygen -b 10240 -t rsa -C "Equipo Hadit NnAsUnKnOwn" -f id_rsa
ssh-copy-id -i id_rsa.pub root@tecgnus.cl
ssh root@tecgnus.cl -i id_rsa

Fuentes

  • fc-list
  • xfd
fc-list
fc-list :fontformat=TrueType -f "%{family}\n" | sort -u
xfd -fa 1"xft:monospace:size=8:antialias=true"

Editores

  • nano
  • vim
  • jed
  • emacs
  • pico
  • mped #curses for programming
  • levee #curses based on vim

Gestor de repositorios apt

  • aptitude
  • apt
  • dpkg

Desarrollo

make menuconfig

Navegadores

  • dwb
  • lynx
  • w3m

File Managers

  • mc #curses #Midnight Commander – a powerful file manager
  • vifm #curses #un gestor de archivos basado en ncurses con atajos tipo vi
  • nautilus
  • spacefm
  • kupfer
  • synapse
  • catfish
  • pcmanfm
  • gmrun
  • dmenu
  • ncdu #curses #disk usage viewe

Curses

  • tina #text-based personal information manager
  • alpine #Cliente de correo electrónico en modo texto, amigable para los novatos, pero potente
  • mutt #Lector de correo en modo texto que soporta MIME, GPG, PGP y seguimiento de hilo
  • abook #Agenda de direcciones en ncurses
  • textdraw #Tool to draw/modify/move geometric figures & text for ASCII art
  • tpp #text presentation program
  • calcurse #text-based calendar and todo manager
  • charm #terminal based blogs publishing application
  • rtorrent #ncurses BitTorrent client based on LibTorrent from rakshasa
  • aview #Un visor de imágenes y reproductor de vídeo en arte en código ASCII de alta calidad.
  • vux #command-line Audio Player
  • multitail #view multiple logfiles windowed on console

Backgrounders :

  • disown
  • nohup
  • screen
  • tmux
  • bg

Cpu Gobernors :

  • cpulimit
  • cpufreqd
  • ondemand
  • cpufrequtils
  • loadcpufreq
cpulimit -c 4 -l 50 -P /usr/lib/abrowser/abrowser
echo conservative | sudo tee /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

Diseño y dibujo :

  • librecad
  • freecad
  • gimp
  • inkscape

Escritorios remotos

  • remmina
  • rdesktop

Electrónica :

  • KiCad

*.{pro,net,sch,brd,lst} #kiCad Files

  • gschem
  • geda
  • easyspice
  • pcb
  • oregano
  • tkgate
  • qucs

SoftPhone :

  • linphone
  • qutecom
  • twinkle
  • ekiga
  • yate
  • jitsi

Web Mail Client :

  • roundcube4
  • squirrelmail

*wk MTA :

  • exim
  • postfix
  • sendmail
  • thunderbird

Mensajeria Instantanea :

  • pidgin
  • finch #ncurses #pidgin
  • weechat-curses #curses
  • irssi #curses
  • bitlbee #curses
  • barnowl #curses
  • thunderbird

Status & Menus Bars :

  • dzen2
  • dmenu
  • xmobar
  • tint2

Configuracion X Server

  • wmctrl
  • xlsfonts
  • xlsatoms
  • xwininfo
  • xprop
  • editres
  • xrdb
  • appres
  • listres
xprop | grep STRUT
  • xev
  • xlsclients :
xlsclients -m 10 -l 2>&1 | grep -o -E '(0x[[:xdigit:]]{7})' | xargs -L1 -I ARG xprop -id ARG _NET_WM_PID | grep -E 'xcalc|$'
  • cvt
  • xvt
  • gtf
  • startx
  • xrdb
xrdb -load $HOME/.Xresources
  • xsetroot -solid gray &
  • xinit

Comandos Bind Keys :

  • xev
  • xmodmap
  • lshal
  • showkey

GTK Testers

  • awf-gtk3
  • awf-gtk2
  • lxappearance

WebApp, P2P, etc :

  • yacy
  • freenet
  • ttrss
  • Owncloud
  • NextCloud
  • SparkleShare
  • Stacksync
  • OpenStack
  • nicotine
  • opencart
  • woocommerce

Reproductores :

  • ncmpcpp #curses
  • clementine
  • vlc
  • mpv

Redes

  • speedometer $speedometer -rx wlan0 -tx wlan0
  • iftop #curses
  • iptraf #curses
  • ifstatus
  • mtr
  • netstat -anltp
  • nmap
nmap -v -sP 192.168.69.0/24

Wifi :

  • iwlist
iwlist wlan0 scan
  • iw
iw dev wlan0 scan
  • wpa_cli
  • wpa_gui
  • wavemon
  • wicd-curses

Virtualbox :

dpkg-reconfigure virtualbox-dkms
dpkg-reconfigure virtualbox
#raw2virtualbox:
dd if=/dev/sdc of=/path/to/output/disk-image.iso
VBoxManage convertfromraw /path/to/output/disk-image.iso /path/to/output/disk-image.vdi
apt-get install linux-headers-$(uname -r)
ls /lib/modules/$(uname -r)/kernel/drivers

dpkg -i virtualbox-4.1_4.1.36-97684~Debian~wheezy_i386.deb
vim /etc/default/virtualbox

Apt-get

To build a package from source, first install the build dependencies: sudo apt-get build-dep <package> Then use dpkg-buildpackage to create a .deb file. From APT and Dpkg Quick Reference Sheet: dpkg-buildpackage Builds a Debian package from a Debian source tree. You must be in the main directory of the source tree for this to work. Sample usage: dpkg-buildpackage -rfakeroot -uc -b Where -rfakeroot instructs it to use the fakeroot program to simulate root privileges (for ownership purposes), -uc stands for “Don’t cryptographically sign the changelog”, and -b stands for “Build the binary package only” In a terminal, cd into the directory containing the package source (e.g ~/code/hellanzb-0.13) and run the following command: dpkg-buildpackage -rfakeroot -uc -b If the build is successful, there will be a .deb file located in the parent directory (e.g ~/code/hellanzb_0.13-6.1_all.deb).

apt-get source <package>
apt-get build-dep <package>

Comandos Grabar ISO :

wodim -eject -tao speed=2 dev=/dev/sr1 -v -data myiso.iso
growisofs -dvd-compat -Z /dev/sr1=myiso.iso

Comandos File Openers :

  • xdg-open
  • gvfs-open
  • kde-open
  • exo-open
  • run-mailcap
  • mailcap
  • update-mime
run-mailcap | see
cat /etc/mailcap
update-mime-database /usr/share/mime
cat /etc/mime.types
cat mimeapps.list

Programitas :

  • wavemon
  • speedometer $speedometer -rx wlan0 -tx wlan0
  • wicd-curses #curses
  • iftop #curses
  • ifstatus
  • mtr #curses
  • htop #curses
  • alsamixer
  • dstat
  • cvt
  • xvt
  • gtf

Monitores curses

  • atop
  • htop
  • cbm

muestra el tráfico de red actual en colores

  • bwm-ng

small and simple console-based bandwidth monitor

  • dstat

herramienta estadística versátil de recursos. #its the replacement of vmstat, iostat, netstat and ifstat.

  • iotop

simple top-like I/O monitor

  • iostat
  • netstat
  • ifstat
  • bmon

monitor de ancho de banda portátil y estimador de franja

  • apachetop

Herramienta de monitorización de Apache en tiempo real

  • saidar

curses-based program which displays live system statistics

  • vnstat

console-based network traffic monitor

  • ethstatus

console-based ethernet statistics monitor

Terminos Para Aprender :

  • tls
  • sassl
  • ssl
  • ldap
  • heartbeat
  • drbd
  • rsync
  • haproxy
  • ldirectord
  • qos
  • nagios

Stream :

ffmpeg -r 40 -s 1024x768 -f x11grab -i :0.0 http://localhost:8090/webcam.ffm
  <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="320" height="240">
    <param name="movie" value="archivo.swf" />
    <param name="quality" value="high" />
    <embed src="http://localhost:8090/webcam1.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="32" height="32"></embed>
  </object>

ffmpeg -i tbe.flv -ss 00:00:12 -t 00:00:4.300 -s 600x450 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=7 --loopcount > output.gif

VIM Commands :

:so $VIMRUNTIME/syntax/hitest.vim

  • Reemplazar :

:1,$ s/original/otro/g :1,$ s/SESSION_USER/SESSION_USR/g :1,$ s/|\ \ /\t/g : Reemplazar pipes por tabs. <CTRL>+W : Cambia de foco :vs | :30sp : Split vertical para la ventana con el foco :sp | :30sp : Split horizontal para la ventana con foco :vertical resize 30 : determina el tamaño de la ventana con foco :res +10 | res -10 :mksession <file> : Graba session $ vim -p * $ vim -S <file> : Abre session grabada :TlistToggle : Script ctags

  • Add & Remove TABS to selection

SHIFT+[ > | < ]

  • El punto ( . ), repite la ultima operacion.
  • v + CTRL+V (SELECCIONAR AREA A COMENTAR) + I (INSERTAR) + ESC ESC

Elimina Logs

find . -regextype posix-extended -regex '^.*\.(log\.[0-9]{1}|gz)$' -exec rm - rf {} \;
find . -regextype posix-extended -regex '^.*\.([0-9]{1}|log\.[0-9]{1}|gz)$' -exec rm -rf {} \;

Busqueda, muestra archivo t :

find . -exec egrep -in -H 'mysqlConsulta' {} \; 

Busca por expresion y ejecuta una accion :

find . -exec egrep -l 'nnasunknown' {} \; 2>&1 | grep -v -e directorio -e .git\/ | xargs -L1 -I ARG0 sed -i.bk "s/nnasunknown/juanin/g" ARG0
find . -exec egrep '(\["sistema"\]|\['sistema'\]|tecgnus)' {} \;
find . -exec egrep -l '(\["sistema"\]|\['sistema'\])' {} \; | xargs -L1 -I ARG0 sed "s/\[[',\"]sistema[',\"]\]//g" ARG0
find . -exec egrep -l '(\["sistema"\]|\['sistema'\])' {} \; | xargs -L1 -I ARG0 cp ARG0 pruebas/
find . -exec egrep -l '(\["sistema"\]|\['sistema'\])' {} \; | xargs -L1 -I ARG0 sed -i.bk "s/\[[',\"]sistema[',\"]\]//g" ARG0
find . -name "mod_*.zip" -exec unzip -xo {} \;
find . -exec grep -l \'sistema\' {} \; | xargs -L1 -I ARG0 sed "s/\['sistema'\]//g" ARG0 > ARG0
find . -exec grep -l new\ ClassConfiguracion {} \;

Encontrar solo archivos desde la posicion actual en una profundidad de 10 directorios con cualquier nombre y antiguedad mayor o igual a cuatro horas

find . -maxdepth 10 -type f -name '*' -mmin -240 -exec du -hk --max-depth=0 {} \; | awk '{print $2}' | more

Encontrar directorios y archivos desde la posicion actual en una profundidad de 10 directorios con cualquier nombre y antiguedad mayor o igual a cuatro horas

find . -maxdepth 10 -name '*' -mmin -240 -exec du -hk --max-depth=0 {} \; | awk '{print $1}'

enlaces simbolicos recursivos :

find ../mysql/bin -type f -name '*' -exec ln -s {} \;
find . -name '*.php' -exec grep -l \'Orders\' {} \; | xargs -L1 -I ARG0 sed -i.bak "s/'Orders'/'Órdenes'/g" ARG0
sudo cat /var/log/auth* | grep Accepted | awk '{print $1 " " $2 "\t" $3 "\t" $11 "\t" $9 }
nast -m

Tamaño de archivos ocultos

du -sk .[!.]* *| sort -n
watch -n1  du -sch .[!.]* * \| sort -h \| pr -3 -t2

Buscar archivos con find

find . -wholename '*shorewall/masq' -exec cat {} \;
find -type f -printf '%P\000' | egrep -iz '\.(avi|mpg|mov|flv|wmv|asf|mpeg|m4v|divx|mp4|mkv)$' | sort -z | xargs -0 ls -1 >
sendemail -f chinoforeverr@hotmail.com -t nnasunknown@gmail.com -s smtp.live.com:587 -u Prueba1 -m "USB Attached" -xu chinoforeverr@hotmail.com -xp awakeningpath361 -o tls=yes
openssl s_client -starttls smtp -crlf -connect smtp.live.com:587
perl -MMIME::Base64 -e 'print encode_base64("\000chinoforeverr\@hotmail.com\000awakeningpath361")'
openssl s_client -connect smtp.live.com:587 -starttls smtp -crlf

Cambiar fondo pantalla GDM

xhost +SI:localuser:gdm
sudo -u gdm dbus-launch gnome-control-center

wget -r -q -O - "http://192.168.69.1:8004" | buffer -S 760 |sox -t flac - -t alsa default
wget "http://LONG&BIZARRE-FILEURI" --output-document "La Danza de Los Mirlos.mp3"

Bash

sync && echo 3 > /proc/sys/vm/drop_caches
rm -rf .*.{swn,swo,swp,swl,swm}
ls -Sh | head -n 10 | xargs tar -cvf los10masFat.tgz
ls *.{gz,php}
echo w{i,e}on

Dividir archivos por cantidad de filas

wc -l alarchivo.da1 =>  si el archivo tiene más de 5000 registros dividirlo.
sed -e 's/,/\t/g' x.txt > ./x.txt

head -n 5000 x.txt > vi1.txt
tail -n+5001 x.txt | head -n 5000 > vi2.txt
tail -n+10002 x.txt | head -n 5000 > vi3.txt
tail -n+15003 x.txt | head -n 5000 > vi4.txt
tail -n+20004 x.txt | head -n 5000 > vi5.txt
tail -n+25005 x.txt | head -n 5000 > vi6.txt
tail -n+30006 x.txt | head -n 5000 > vi7.txt
tail -n+35007 x.txt | head -n 5000 > vi8.txt
tail -n+40008 x.txt | head -n 5000 > vi9.txt
tail -n+45009 x.txt | head -n 5000 > vi10.txt
tail -n+50010 x.txt | head -n 5000 > vi11.txt
tail -n+55011 x.txt | head -n 5000 > vi12.txt

Haskell :

envVar x = do
	var <- getEnv x
	return (var)
homeDir = envVar "HOME"
envPath = envVar "PATH"

Buscar archivos por tipo mime

find . -name '*' -exec file {} \; | grep -o -P '^.+: \w+ image' | cut -d \: -f1 >> ./images.txt
cat images.txt | xargs -L1 -I ARG0 rsync -a --relative ARG0 ahorati/

Sed Como :

Borrar una línea

sed 'nºd' fichero
sed '1d' fichero

Indicar un intervalo de líneas a borrar.

sed '3,5d' fichero

También podemos indicar que queremos borrar desde una determinada línea en adelante

sed '3,$d' fichero

Borrar líneas en blanco de un fichero

sed '/^$/d' fichero

Elimina comentarios #

sed '/^#/d' /etc/services

A la hora de borrar, también podemos especificar una cadena, de tal forma que el comando borrará todas las líneas que contengan esa cadena

cat fichero | sed '/^[ ]*$/d' > ficherodestino
sed '/git/d' .bash_history >> .bash_history.sinGit

Otro de los usos interesantes es borrar los espacios al comienzo de cada línea

sed 's/^ *//g' fichero

O borrar los espacios al final de cada línea

sed 's/ *$//g' fichero

Sustituir una cadena por otra

sed 's/cadena1/cadena2/' fichero

Al ejecutar el comando anterior, se sustituye la primera cadena que encuentra por la segunda. Pero, si lo que queremos es sustituir todas las cadenas que encuentre, en cada una de las líneas, añadimos el parámetro g:

sed 's/cadena1/cadena2/g' fichero

Sustituir cadena1 por cadena2 en un número de línea concreto

sed '5 s/USUARIO/usuario/g' fichero

Tenemos un fichero con campos en los que el separador es el tabulador y queremos sustuir este caracter separador por otro caracter separador, como por ejemplo el punto y coma (;)

sed 's/\t/;/g' fichero

Mostrar lineas que comienzan con d y e, parametro -n muestra solo coincidencias

sed -n -e '/^[de]/p' texto1

Al mezclar dos expresiones imprimimos /p desde linea Vivimos hasta linea tecnologia

sed -n -e '/Vivimos/,/tecnología/p' texto1

Notification daemons

/usr/lib/i386-linux-gnu/notify-osd
/usr/lib/notification-daemon/notification-daemon

Arduino UNO

avrdude -c arduino -p m328p -P /dev/ttyUSB1 -b 115200 -U flash:w:frser-duino.hex

Youtube-Dl

#| jq -r '.id + "\t" + .title'
youtube-dl -j --flat-playlist "https://www.youtube.com/watch?v=4Cg2O4SsHQw&index=2&list=PL7HuF7ngaDLVozZqOdWqcxS6nNRJfq3iT"
youtube-dl -j --flat-playlist "https://www.youtube.com/watch?v=4Cg2O4SsHQw&index=2&list=PL7HuF7ngaDLVozZqOdWqcxS6nNRJfq3iT" | jq -r '.title + "\thttps://youtube.com/watch?v=" + .id'
youtube-dl -j --flat-playlist "https://www.youtube.com/watch?v=4Cg2O4SsHQw&index=2&list=PL7HuF7ngaDLVozZqOdWqcxS6nNRJfq3iT" | jq -r '.id' | sed 's_^_https://youtube.com/watch?v=_'
youtube-dl -j --flat-playlist "https://www.youtube.com/watch?v=4Cg2O4SsHQw&index=2&list=PL7HuF7ngaDLVozZqOdWqcxS6nNRJfq3iT" | jq -r '.title + "\thttps://youtube.com/watch?v=" + .id' | dmenu -l 10 | awk -F $'\t' '{print $2}
youtube-dl -j --flat-playlist "https://www.youtube.com/watch?v=4Cg2O4SsHQw&index=2&list=PL7HuF7ngaDLVozZqOdWqcxS6nNRJfq3iT" | jq -r '.title + "\thttps://youtube.com/watch?v=" + .id' | dmenu -l 10 | awk -F $'\t' '{print $2}' | xargs -L1 -I ARG0 mpv `youtube-dl -g "ARG0"`
youtube-dl -j --flat-playlist "https://www.youtube.com/watch?v=4Cg2O4SsHQw&index=2&list=PL7HuF7ngaDLVozZqOdWqcxS6nNRJfq3iT" | jq -r '.title + "\thttps://youtube.com/watch?v=" + .id' | dmenu -l 10 | awk -F $'\t' '{print $2}' | xargs -L1 -I ARG0 youtube-dl -g "ARG0" | xargs -L1 -I ARG0 mpv ARG0
youtube-dl -j --flat-playlist "https://www.youtube.com/watch?v=4Cg2O4SsHQw&index=2&list=PL7HuF7ngaDLVozZqOdWqcxS6nNRJfq3iT" | jq -r '.title + "\thttps://youtube.com/watch?v=" + .id' | dmenu -l 10 | awk -F $'\t' '{print $2}' | xargs -L1 -I ARG0 youtube-dl -g "ARG0" | xargs -L1 -I ARG0 mpv ARG0
youtube-dl -j --flat-playlist "https://www.youtube.com/watch?v=4Cg2O4SsHQw&index=2&list=PL7HuF7ngaDLVozZqOdWqcxS6nNRJfq3iT" | jq -r '.title + "\thttps://youtube.com/watch?v=" + .id' | dmenu -l 10 | awk -F $'\t' '{print $2}' | xargs -L1 -I ARG0 youtube-dl -g "ARG0" | xargs -L1 -I ARG0 mpv ARG0
youtube-dl -j --flat-playlist "https://www.youtube.com/watch?v=4Cg2O4SsHQw&index=2&list=PL7HuF7ngaDLVozZqOdWqcxS6nNRJfq3iT" | jq -r '.title + "\thttps://youtube.com/watch?v=" + .id' | dmenu -l 10 | awk -F $'\t' '{print $2}' | xargs -L1 -I ARG0 youtube-dl -g "ARG0" | xargs -L1 -I ARG0 mpv ARG0
youtube-dl -j --flat-playlist "https://www.youtube.com/watch?v=4Cg2O4SsHQw&index=2&list=PL7HuF7ngaDLVozZqOdWqcxS6nNRJfq3iT" | jq -r '.title + "\thttps://youtube.com/watch?v=" + .id' | dmenu -i -nb $myBgColor -nf $myFgColor -sb $mySbgColor -l 10 | awk -F $'\t' '{print $2}' | xargs -L1 -I ARG0 youtube-dl -g "ARG0" | xargs -L1 -I ARG0 mpv ARG0
youtube-dl -j --flat-playlist "https://www.youtube.com/watch?v=4Cg2O4SsHQw&index=2&list=PL7HuF7ngaDLVozZqOdWqcxS6nNRJfq3iT" | jq -r '.title + "\thttps://youtube.com/watch?v=" + .id' | dmenu -i -nb $myBgColor -nf $myFgColor -sb $mySbgColor -l 10 | awk -F $'\t' '{print $2}' | xargs -L1 -I ARG0 youtube-dl -g "ARG0" | xargs -L1 -I ARG0 mpv ARG0
youtube-dl -j --flat-playlist "https://www.youtube.com/watch?v=4Cg2O4SsHQw&index=2&list=PL7HuF7ngaDLVozZqOdWqcxS6nNRJfq3iT" | jq -r '.title + "\thttps://youtube.com/watch?v=" + .id' | dmenu -i -fn "$myXftFont" -nb $myBgColor -nf $myFgColor -sb $mySbgColor -l 10 | awk -F $'\t' '{print $2}' | xargs -L1 -I ARG0 youtube-dl -g "ARG0" | xargs -L1 -I ARG0 mpv ARG0
youtube-dl -o - N6voHeEa3ig | mpv -cache 1024 -
youtube-dl -o - "https://www.youtube.com/watch?v=N6voHeEa3ig" | mpv -

build VIM

apt-get install libpython3.4-dev libpython2.7-dev
make clean && make distclean && make uninstall && ./configure --prefix=/usr/ --enable-fontset --enable-multibyte --with-x --with-python-config-dir=/usr/lib/python2.7/config-x86_64-linux-gnu/ --with-python3-config-dir=/usr/lib/python3.4/config-3.4m-x86_64-linux-gnu/ --enable-pythoninterp --enable-python3interp --enable-gui=no
./configure --prefix=/home/juanin/Descargas/PROGRAMAS/builded/vim/builded/ --enable-fontset --enable-multibyte --with-x --with-python-config-dir=/usr/lib/python2.7/config-i386-linux-gnu/ --with-python3-config-dir=/usr/lib/python3.4/config-3.4m-i386-linux-gnu/ --enable-pythoninterp --enable-python3interp
make
make install

Configuracion Emacs ~/.emacs.d/conf.org

Cargar modulos descargados en ~/.emacs.d/custom/

(let ((default-directory "~/.emacs.d/custom/"))
(normal-top-level-add-subdirs-to-load-path))

Multiples Modos mmm-mode

(require 'mmm-mode)
(setq mmm-global-mode 'maybe)
(mmm-add-mode-ext-class nil "\\.php3?\\'" 'html-php)
(mmm-add-classes
 '((html-php
    :submode php-mode
    :front "<\\?\\(php\\)?"
    :back "\\?>")))
(autoload 'php-mode "php-mode" "PHP editing mode" t)
(add-to-list 'auto-mode-alist '("\\.php3?\\'" . sgml-html-mode))

Misc

  ;;     (standard-display-ascii ?\t "» ")
       (setq tab-width 2)
       (setq-default tab-width 2)
       ;;(whitespace-tab-width tab-width)
       (setq-default indent-tabs-mode t)
       (setq c-basic-offset 2)
       (setq whitespace-style '(tabs tab-mark newline ))
       ;;(setq c-basic-indent 2)

;;  (mapc
;;   (lambda (mode)
;;     (font-lock-add-keywords
;;      mode
;;      '(("ARR" 0 'whitespace-tab)
;;        ;;("\u00BB[[:space:]]" 0 'whitespace-tab))
;;        ("\u00BB[[:blank:]]" 0 'whitespace-tab))
;;      )
;;     )
;;   '(text-mode latex-mode html-mode emacs-lisp-mode exinfo-mode php-mode org-mode)
;;   )


;;  (setq whitespace-display-mappings
;;   '(
;;     (space-mark   ?\     [? ]) ;; use space not dot
;;     (space-mark   ?\xA0  [?\u00A4]     [?_])
;;     (space-mark   ?\x8A0 [?\x8A4]      [?_])
;;     (space-mark   ?\x920 [?\x924]      [?_])
;;     (space-mark   ?\xE20 [?\xE24]      [?_])
;;     (space-mark   ?\xF20 [?\xF24]      [?_])
;;     (newline-mark ?\n    [?$ ?\n])
;;     (tab-mark     ?\t    [?\u00BB ?\t] [?\\ ?\t])))
  • Indent TABS :
;;(setq-default indent-tabs-mode t)
;;(setq tab-width 3) ; or any other preferred value
;;(highlight-indentation-mode 1)
;;(set-face-backgrxound 'highlight-indentation-face "#e3e3d3")
;;(set-face-background 'highlight-indentation-current-column-face "#c3b3b3")
;;(require 'indent-guide)
;;(indent-guide-global-mode)

Carga Plugin Evil evil-mode

(require 'evil)
(evil-mode 1)

Carga Org-Mode

org-mode es un administrador de información personal y una herramienta fuera de linea(herramienta de bosquejo) para emacs. Este documento intenta dar al lector un acercamiento a los principios basicos de operacion.

  • Instalar org-mode M-x package-install org
  • Links :
    • C-c C-l : Crea un nuevo link
    • C-c c : Almacena una posicion en un archivo para crearlo con C-c C-l en otro archivo
    • C-c C-o : Abre un Link
  • Exportar :
    • C-c C-e : Exporta en distintos formatos un archivo org
    • C-c C-e : Exportar .org a otros formatos
  • Check/Describe Variables :
    • C-h v : Describe Variable
    • C-h a : Describe Hotkey
    • C-h ? : Muestra ayuda
  • Tablas, Estas se crean así tal cual |-Tab
  • Bloques de codigo/Source Blocks :
    • <s TAB : En un buffer el snippet <s TAB nos crea un bloque
    • C-c ‘ : Es posible modificar codigo de un bloque en un nuevo buffer con C-c ‘
    • C-c ; : Agrega commentario al inicio de una entrada
    • C-c C-c : Evalua un block de codigo
  • Includes/Incluir :
#+INCLUDE: "~/.local/scripts/1024x768-1280x1024" src bash :lines "3-5"
#+INCLUDE: "~/.local/scripts/1024x768-1280x1024" src bash
  • Agenda :
    • C-c C-d : Set deadline date
    • C-c C-t | Shift-[Left|Right] : DONE, TODO stuff
    • C-c C-s : Set schedule date
    • C-c a : Agenda View
    • En un buffer es posible añadir más estados de agenda :
      • C-c C-c : ACTIVAR SEQ_TODO ya definido en buffer
#+SEQ_TODO: NEXT(n) TODO(t) WAITING(w) SOMEDAY(s) PROJECT(p) | DONE(d) CANCELLED(c)
(require 'org)
(define-key global-map "\C-cl" 'org-store-link)
(define-key global-map "\C-ca" 'org-agenda)
(setq org-done t)

Markdown-Mode markdown-mode

(use-package markdown-mode
  :ensure t
  :commands (markdown-mode gfm-mode)
  :mode (("README\\.md\\'" . gfm-mode)
         ("\\.md\\'" . markdown-mode)
         ("\\.markdown\\'" . markdown-mode))
  :init (setq markdown-command "multimarkdown"))

NerdTree Like neotree

(require 'neotree)
(global-set-key [f8] 'neotree-toggle)

PHP Plugins

(eval-after-load 'php-mode
    '(require 'php-ext))
(with-eval-after-load 'php-mode
    (define-key php-mode-map (kbd "C-c C--") 'php-current-class)
    (define-key php-mode-map (kbd "C-c C-=") 'php-current-namespace))
(add-hook 'php-mode-hook
'(lambda ()
    (require 'company-php)
    (company-mode t)
    (ac-php-core-eldoc-setup) ;; enable eldoc
    (make-local-variable 'company-backends)
    (add-to-list 'company-backends 'company-ac-php-backend)))
(setq auto-mode-alist
(append
    '(("\\.php" . php-mode)) auto-mode-alist))

(add-hook 'after-init-hook 'global-company-mode)
(run-hooks 'after-init-hook)
;;; test-ac-php.el ends here

(require 'cl)
(require 'php-mode)
(add-hook 'php-mode-hook
'(lambda ()
    (auto-complete-mode t)
    (require 'ac-php)
    (setq ac-sources  '(ac-source-php ))
    (yas-global-mode 1)
    (ac-php-core-eldoc -setup ) ;; enable eldoc
    (define-key php-mode-map  (kbd "C-]") 'ac-php-find-symbol-at-point) ;;goto define
    (define-key php-mode-map  (kbd "C-t") 'ac-php-location-stack-back)    ;;go back
    ))

(require 'flymake-php)
(add-hook 'php-mode-hook 'flymake-php-load)

Autocompletar web-mode

(require 'web-mode)
(add-to-list 'auto-mode-alist '("\\.phtml\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.tpl\\.php\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.[agj]sp\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.as[cp]x\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.erb\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.mustache\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.djhtml\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode))

(autoload 'php-mode "php-mode" "Major mode for editing PHP code." t)
(add-to-list 'auto-mode-alist '("\\.php$" . php-mode))
(add-to-list 'auto-mode-alist '("\\.inc$" . php-mode))

Org-Mode with CalDav org-caldav & org-agenda

(require 'org-caldav)

(with-eval-after-load 'org-caldav
  (setq org-caldav-url "https://oc.tecgnus.cl:9094/remote.php/dav/calendars/c3addb26-b91c-1034-96ba-177eec2c2c54"
  ;;org-caldav-calendar-id "personal"
  ;;org-caldav-inbox "~/org-caldav/fromPersonal.org"
  ;;org-caldav-files '("~/org-caldav/calendar.org" "~/org-caldav/calendar1.org")
  ;;org-caldav-files '("~/org-caldav/personal.org")
  org-icalendar-timezone "America/Santiago"
  org-caldav-debug-level 2))

  (setq org-caldav-calendars
  '( (:calendar-id "diy" :files ("~/org-caldav/diy.org") :inbox "~/org-caldav/fromDiy.org")
  (:calendar-id "estudios" :files ("~/org-caldav/estudios.org") :skip-conditions (regexp "soccer") :inbox "~/org-caldav/fromEstudios.org")
  (:calendar-id "personal" :files ("~/org-caldav/personal.org") :skip-conditions (regexp "soccer") :inbox "~/org-caldav/fromPersonal.org") ) )

  (setq org-agenda-files (list "~/org-agenda/agenda.org" "~/org-agenda/todo.org" "~/org-caldav"))

Comprobador de Sintaxis flycheck

(use-package flycheck
  :ensure t
  :init (global-flycheck-mode))

Undo-Tree Undo-Tree

  • C-x u : Visualizar arbol.
(global-undo-tree-mode)

IDO InteractivelyDoThings & Smex : ido-completing-read-plus

Es una nueva rama de ido-ubiquitous

(require 'ido)
(ido-mode t)
(ido-everywhere 1)
;;Melpa M-x package-install ido-completing+
(require 'ido-completing-read+)
(ido-ubiquitous-mode 1)

M-x ido para los comandos usados comunmente :

(require 'smex)   ; Not needed if you use package.el
(smex-initialize) ; Can be omitted. This might cause a (minimal) delay
      ; when Smex is auto-initialized on its first run.


(global-set-key (kbd "C-c i") 'smex)
(global-set-key (kbd "C-c I") 'smex-major-mode-commands)
;; This is your old M-x.
(global-set-key (kbd "C-c C-c M-x") 'execute-extended-command)

Helm & Helm-Projectile & Helm-Smex helm, helm-ag, helm-projectile, helm-smex, helm-descbinds

(require 'helm)
(require 'helm-config)
(require 'helm-projectile)

(global-set-key (kbd "M-x")       #'helm-M-x)
(global-set-key (kbd "C-x C-m")   #'helm-M-x)
(global-set-key (kbd "C-x r b")   #'helm-filtered-bookmarks)
(global-set-key (kbd "C-x C-f")   #'helm-find-files)
(global-set-key (kbd "C-x b")     #'helm-mini)
(global-set-key (kbd "C-x C-b")   #'helm-buffers-list)
(global-set-key (kbd "C-x C-r")   #'helm-recentf)
(global-set-key (kbd "C-x c") nil) ;; Remove the old keybinding
(global-set-key (kbd "C-x c y")   #'helm-show-kill-ring)
(global-set-key (kbd "C-x c Y")   #'helm-all-mark-rings)


(global-set-key (kbd "M-s o")     #'helm-swoop)
(global-set-key (kbd "M-s /")     #'helm-multi-swoop)
(global-set-key (kbd "C-c h o")   #'helm-occur)

(global-set-key (kbd "C-c h x")   #'helm-register)
(global-set-key (kbd "C-c h g")   #'helm-google-suggest)
(global-set-key (kbd "C-c h M-:") #'helm-eval-expression-with-eldoc)
(global-set-key (kbd "C-c h")     #'helm-command-prefix)
;;(global-set-key (kbd "C-M-z") #'helm-resume)

(setq helm-split-window-inside-p t)
(setq helm-M-x-always-save-history t)
(setq helm-M-x-reverse-history t)
(setq helm-always-two-windows t)
(setq helm-autoresize-max-height 20)
(setq helm-autoresize-mode nil)
(setq helm-descbinds-mode t)
(setq helm-descbinds-window-style (quote split-window))
(setq helm-display-buffer-default-height 30)
(setq helm-display-header-line nil)
(setq helm-echo-input-in-header-line t)
(setq helm-ff-file-name-history-use-recentf t)
(setq helm-move-to-line-cycle-in-source nil)
(setq helm-prevent-escaping-from-minibuffer t)
(setq helm-scroll-amount 8)

(require 'helm-smex)
(global-set-key [remap execute-extended-command] #'helm-smex)
(global-set-key (kbd "M-X") #'helm-smex-major-mode-commands)

(require 'helm-descbinds)
(helm-descbinds-mode)
(helm-projectile-on)
(helm-mode 1)

Projectile projectile

;;(projectile-mode)
(projectile-global-mode)

Muestra numero de linea

(setq linum-format "%d ")
(setq linum-format "%4d \u2502 ")
(add-hook 'prog-mode-hook 'linum-mode)        ;; Esta linea convierte de 256 a 8 colores.
(add-hook 'text-mode-hook 'linum-mode)        ;; Esta linea convierte de 256 a 8 colores.
(add-hook 'org-mode-hook 'linum-mode)       ;; Esta linea convierte de 256 a 8 colores.
;;(global-linum-mode t)
;;(setq-default left-fringe-width  10)
;;(setq-default right-fringe-width  0)
;;(set-face-attribute 'fringe nil :background "black")
;;(set-window-margins nil 1)

Ilumina la linea del cursor

(global-hl-line-mode 1)

Grabar el historial del mini buffer M-x

(savehist-mode 1)

Grabar Sessiones Emacs

(desktop-save-mode 1)

Org2Blog ox-wp-crayon.el, org2blog

(require 'xml-rpc)
(require 'org2blog-autoloads)
(require 'auth-source)
(require 'org2blog)

(add-to-list 'auth-sources "~/.netrc")
(setq auth-sources '(
"~/.netrc"
))

(setq org2blog/wp-default-title "Hola Mundillo")

;;Ojo!! en vez de ocupar ' se utiliza `
(setq org2blog/wp-blog-alist
      `(("TecGNUs"
         :url "http://tecgnus.cl/xmlrpc.php"
         :username ,(car (auth-source-user-and-password "tecgnus.cl"))
         :password ,(cadr (auth-source-user-and-password "tecgnus.cl"))
         :default-title "Nueva Entrada"
         :default-categories ("org2blog" "emacs")
         :tags-as-categories nil)
        ("Edis"
         :url "http://edis.cl/xmlrpc.php"
         :username ,(car (auth-source-user-and-password "edis.cl"))
         :password ,(cadr (auth-source-user-and-password "edis.cl"))
         :default-title "Nueva Entrada"
         :default-categories ("org2blog" "emacs")
         :tags-as-categories nil)))

;;(require 'ox-wp-crayon)
;;(setq org2blog/wp-use-sourcecode-shortcode t)
;;(setq org2blog/wp-sourcecode-default-params t)
;;(setq org2blog/wp-sourcecode-langs
;;'("actionscript3" "bash" "coldfusion" "cpp" "csharp" "css" "delphi"
;;"erlang" "fsharp" "diff" "ditaa" "groovy" "javascript" "js" "java" "javafx" "matlab"
;;"objc" "perl" "php" "text" "powershell" "python" "ruby" "scala" "sql"
;;"vb" "xml" "sh" "elisp" "R" "org" "lisp" "emacs-lisp" "lua" "sql" "org" "haskell"
;;"c++" "python" "php" "mysql" "ruby"))


(setq org2blog/wp-use-sourcecode-shortcode nil)
(setq org2blog/wp-sourcecode-langs
    '("actionscript3" "bash" "coldfusion" "cpp" "csharp" "css" "delphi"
    "erlang" "fsharp" "diff" "ditaa" "groovy" "javascript" "js" "java" "javafx" "matlab"
    "objc" "perl" "php" "text" "powershell" "python" "ruby" "scala" "sql"
    "vb" "xml" "sh" "elisp" "R" "org" "lisp" "emacs-lisp" "lua" "sql" "org" "haskell"
    "c++" "python" "php" "mysql" "ruby"))
(setq org-src-fontify-natively t)

YasSnippets yasnippet

;;(add-to-list 'warning-suppress-types '(yasnippet backquote-change))

GIT magit

Tips

M-x load-file <ret> X-x eval-buffer <ret> M-x byte-recompile-directory ~/.emacs.d/elpa/ C-q <tab> : ????

M-x, IDO’s Alternatives

Ordenar

;;(setq load-path
;;  (append '("~/.emacs.d/polymode/"  "~/.emacs.d/polymode/modes")
;;    load-path))
;;(add-hook 'after-init-hook #'global-flycheck-mode)

;;(require 'poly-R)
;;(require 'poly-markdown)
;;;;; MARKDOWN
;;(add-to-list 'auto-mode-alist '("\\.md" . poly-markdown-mode))
;;;;; R modes
;;(add-to-list 'auto-mode-alist '("\\.Snw" . poly-noweb+r-mode))
;;(add-to-list 'auto-mode-alist '("\\.Rnw" . poly-noweb+r-mode))
;;(add-to-list 'auto-mode-alist '("\\.Rmd" . poly-markdown+r-mode))


;;(require 'mmm-mode)
;;(setq mmm-global-mode 'maybe)
;;(mmm-add-mode-ext-class 'html-mode "\\.php\\'" 'html-php)
;;(mmm-add-classes
;; '((html-php
;;    :submode php-mode
;;    :front "<\\?\\(php\\)?"
;;    :back "\\?>")))
;;(autoload 'php-mode "php-mode" "PHP editing mode" t)
;;(add-to-list 'auto-mode-alist '("\\.php3?\\'" . sgml-html-mode))

Haskell-Platform Como

https://www.haskell.org/cabal/download.html

https://www.haskell.org/downloads/linux