Instalamos el cliente de postgresql
apt install postgresql-client libpq-dev
-- http://www.postgresql.org/docs/9.3/static/app-psql.html#APP-PSQL-PROMPTING
-- \set PROMPT1 '%[%033[1m%]%M %n@%/%R%[%033[0m%]%# '
-- PROMPT2 es lo que imprime cuando está esperando más input
-- \set PROMPT2 '[more] %R > '
\set PROMPT1 '%~%x%# '
-- El mejor formato de salida
-- NOTA: si vas a correr un script tpara sacar datos a un archivo, recuerda desactivar la configuración
\x auto
\set ON_ERROR_STOP on
\set ON_ERROR_ROLLBACK interactive
\pset null '¤'
\pset linestyle 'unicode'
\pset unicode_border_linestyle single
\pset unicode_column_linestyle single
\pset unicode_header_linestyle double
set intervalstyle to 'postgres_verbose';
\setenv LESS '-iMFXSx4R'
\setenv EDITOR 'emacsclient -nw'
-- Muestra cuanto tarda un query en ejecutarse
\timing on
\set VERBOSITY verbose
-- Un history largo
\set HISTSIZE 5000
-- Un history por base de datos
\set HISTFILE ~/.psql_history- :DBNAME
-- Ignora duplicados en el history
\set HISTCONTROL ignoredups
-- No me gusta SQL en mayúsculas
\set COMP_KEYWORD_CASE lower
-- Algunos shortcuts
\set version 'select version();'
\set status 'select pid, age(clock_timestamp(), query_start), usename, query from pg_stat_activity where query != ''<IDLE>'' and query not ilike ''%pg_stat_activity%'' order by query_start desc;'
apt install sqlite3
.header on
.mode column
# Turn off start message:
startup_message off
# Look and feel
caption always "%{= bb}%{+b w}Screen: %n | %h %=%t"
hardstatus alwayslastline
hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{=kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%D, %{B}%d-%m-%Y %{W}%c %A %{g}]'
# Hace que Ctrl+b sea la combinación de escape por default (en lugar de Ctrl+a)
escape ^Bb
# Scroll
defscrollback 10000
mkdir -p ~/tmp/nano-backups
set smooth
set autoindent
set backup
set backupdir "/home/nanounanue/tmp/nano-backups"
set casesensitive
set historylog
set morespace
set tabsize 4
set tabstospaces
set linenumbers
# color
set titlecolor brightwhite,blue
set statuscolor brightwhite,green
#set errorcolor brightwhite,red
set selectedcolor brightwhite,magenta
set numbercolor cyan
set keycolor cyan
set functioncolor green
include "/usr/share/nano/*.nanorc"
#-quicklisp
(let ((quicklisp-init (merge-pathnames "quicklisp/setup.lisp"
(user-homedir-pathname))))
(when (probe-file quicklisp-init)
(load quicklisp-init)))
irbrc
es la Consola de Ruby (equivalente a ipython
)
Tomado de aquí
##
IRB_START_TIME = Time.now
# Imprimit a formato yaml con "y"
require 'yaml'
# Permite cargar gems
require 'rubygems' rescue nil
# Tab completion
require 'irb/completion'
# Save irb sessions to history file
require 'irb/ext/save-history'
# For coloration
require 'wirble'
# For tables
require 'hirb'
# awesome_print
require 'ap'
# Incluye números de línea y niveles de indentación
IRB.conf[:PROMPT][:SHORT] = {
:PROMPT_C=>"%03n:%i* ",
:RETURN=>"%s\n",
:PROMPT_I=>"%03n:%i> ",
:PROMPT_N=>"%03n:%i> ",
:PROMPT_S=>"%03n:%i%l "
}
IRB.conf[:PROMPT_MODE] = :SHORT
# Agrega funcionalidad de readline
IRB.conf[:USE_READLINE] = true
# Auto indentación
IRB.conf[:AUTO_INDENT] = true
# Dónde se guarda la historia
IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb-save-history"
# Cuántas líneas a guardar
IRB.conf[:SAVE_HISTORY] = 1000
# Colorear
Wirble.init(:skip_prompt => true, :skip_history => true)
Wirble.colorize
# Cargar hirb
Hirb::View.enable
# Facilidad de Benchmark
# Basado en => http://pastie.org/179534
def quick(repetitions=100, &block)
require 'benchmark'
Benchmark.bmbm do |b|
b.report {repetitions.times &block}
end
nil
end
# Regresa únicamente los métodos no presentes en los objetos básicos
class Object
def interesting_methods
(self.methods - Object.new.methods).sort
end
end
if ENV.include?('RAILS_ENV')
if !Object.const_defined?('RAILS_DEFAULT_LOGGER')
require 'logger'
Object.const_set('RAILS_DEFAULT_LOGGER', Logger.new(STDOUT))
end
def sql(query)
ActiveRecord::Base.connection.select_all(query)
end
if ENV['RAILS_ENV'] == 'test'
require 'test/test_helper'
end
# for rails 3
elsif defined?(Rails) && !Rails.env.nil?
if Rails.logger
Rails.logger =Logger.new(STDOUT)
ActiveRecord::Base.logger = Rails.logger
end
if Rails.env == 'test'
require 'test/test_helper'
end
else
# nothing to do
end
# annotate column names of an AR model
def show(obj)
y(obj.send("column_names"))
end
puts "> all systems are go wirble/hirb/ap/show <"
# Latexmk configuration file
$makeindex = "makeindex -s gind.ist %O -o %D %S";
add_cus_dep( 'acn', 'acr', 0, 'makeglossaries' );
add_cus_dep( 'glo', 'gls', 0, 'makeglossaries' );
sub makeglossaries {
my ($name, $path) = fileparse( $$Psource );
return system "makeglossaries -d '$path' '$name'";
}
$xelatex = "xelatex %O -interaction=nonstopmode --shell-escape %S";
$xdvipdfmx = 'xdvipdfmx -E -o %D %O %S';
$clean_ext .= "%R.acn %R.acr %R.alg %R.aux %R.auxlock %R.bak %R.bbl %R.blg %R.dvi %R.fls %R.glg %R.glo %R.gls %R.idx %R.ist %R.ilg %R.ind %R.log %R.out %R.pdf %R.ps %R.sav %R.swp %R.toc %R.run.xml %R-blx.bib %R_latexmk %R~ %R.pgf-plot.%R Figures/External/ %R.xdv %R.pyg";
$dvi_previewer = 'start xdvi -watchfile 1.5';
$ps_previewer = 'start gv --watch';
$pdf_previewer = 'start evince';
mkdir -p zathura
apt install -y zathura
# Open document in fit-width mode by default
set adjust-open "best-fit"
# One page per row by default
set pages-per-row 1
#stop at page boundries
set scroll-page-aware "true"
set smooth-scroll "true"
set scroll-full-overlap 0.01
set scroll-step 100
#zoom settings
set zoom-min 10
set guioptions ""
# zathurarc-dark
set font "Iosevka 14"
set default-bg "#1b182c" #00
set default-fg "#cbe3e7" #01
set statusbar-fg "#B0B0B0" #04
set statusbar-bg "#202020" #01
set inputbar-bg "#151515" #00 currently not used
set inputbar-fg "#FFFFFF" #02
set notification-error-bg "#AC4142" #08
set notification-error-fg "#151515" #00
set notification-warning-bg "#AC4142" #08
set notification-warning-fg "#151515" #00
set highlight-color "#F4BF75" #0A
set highlight-active-color "#6A9FB5" #0D
set completion-highlight-fg "#151515" #02
set completion-highlight-bg "#90A959" #0C
set completion-bg "#303030" #02
set completion-fg "#E0E0E0" #0C
set notification-bg "#90A959" #0B
set notification-fg "#151515" #00
set recolor "false"
set recolor-lightcolor "#1b182c" #00
set recolor-darkcolor "#cbe3e7" #06
set recolor-reverse-video "true"
set recolor-keephue "true"
set render-loading "false"
set scroll-step 50
unmap f
map f toggle_fullscreen
map [fullscreen] f toggle_fullscreen
map t recolor
# Enable copy to clipboard
set selection-clipboard clipboard
Improved version of xdg-open
Uso xdg-open test.py
mkdir -p mimi
text/: emacscqlient -c
application/pdf: zathura
video/: vlc
image/: feh
audio/: vlc
application/x-tar: xterm -e 2a
application/x-gzip: xterm -e 2a
application/x-bzip2: xterm -e 2a
application/x-rar: xterm -e 2a
application/x-xz: xterm -e 2a
application/zip: xterm -e 2a
inode/directory: xterm -e ranger
application/vnd.openxmlformats-officedocument.presentationml.presentation: libreoffice