Sunteți pe pagina 1din 48

set time zone

sudo dpkg-reconfigure tzdata

restore apt-get update


https://askubuntu.com/a/477824/346905

remove PPAs from /etc/apt/sources.list.d

LaTeX
sudo add-apt-repository ppa:texlive-backports/ppa
sudo apt-get update
sudo apt-get install texlive-full

Backoffice LCC
descargar fichero jnlp
javaws 39ce474e-59c1-4b84-9be2-2600c335b5c6.pro.jnlp &

AWS S3
copiar ficheros desde local a s3

~/.aws/credentials
[default]
aws_access_key_id = ...
aws_secret_access_key = ...

~/.aws/config
region=eu-west-1

instalar ​boto_rsync
python -m pip install --user boto_rsync

boto-rsync s3://toolbox-webapp-content/content/tasks/ ~/tasks

boto-rsync --access-key AKIAIKVR7JITR7FMNACQ --secret-key


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 ~/opt/toolbox/content/es/task/
s3://toolbox-webapp-content/content/es/task/

(access S3: ​https://s3.console.aws.amazon.com/s3/buckets/toolbox-webapp-content/content/​)

NPM
instalar npm con nvm (última versión) - no usar apt install npm

instalar nvm
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
nvm install node

npm -v

mkdir ~/.aws/
copiar fichero ​credentials​ a .aws

cd proyecto
npm install
npm run release ― para subir

npm run dev ― para ver localmente

subir repo a bitbucket con git

copiar a ~/.gitconfig
[user]
name = Francisco Vico
email = fjvico@uma.es
username = fjvico

inicializar
cd repo
git init
git remote add origin https://git@bitbucket.org:fjvico/toolboxw.git
git remote set-url origin git@bitbucket.org:fjvico/toolboxw.git

hacer commit
cd repo
git add ---all
git commit -m $HOSTNAME
git push -u origin master

clonar
git clone git@bitbucket.org:fjvico/toolboxw.git

Question2Answer
https://devopsmates.com/install-question2answer-centos-7/

## 1. get Q2A
## ​http://docs.question2answer.org/install/

## 2. get unzip
$ yum install unzip .y
$ mkdir tmp
$ cd tmp

## 3. get Spanish language file


$ wget
https://github.com/q2a/question2answer/releases/download/v1.8.0/question2answer-1.8.0
.zip
$ wget ​https://gitlab.com/midget/q2a-translation-es-ES/repository/1.8.0-0/archive.zip

## 4. MySQL
## ​install mysql-server​ if not available
$ mysql -u root -p
(pw: GuadalineXmaria)
## create database
MariaDB [(none)]> CREATE DATABASE toolboxqa
## create user with privileges
MariaDB [(none)]> GRANT INSERT, SELECT, DELETE, UPDATE ON toolboxqa.* TO
'vico'@'localhost' IDENTIFIED BY '<1+>';
MariaDB [(none)]> quit

## 6
$ mv qa-config-example.php qa-config.php

## 7
$ nano qa-config.php
define('QA_MYSQL_HOSTNAME', 'localhost');
define('QA_MYSQL_USERNAME', 'vico');
define('QA_MYSQL_PASSWORD', '<1+>');
define('QA_MYSQL_DATABASE', 'toolboxqa');

$ mkdir /var/www/html/comunidad

## 8
$ cp -r question2answer-1.8.0/* /var/www/html/comunidad/

## 9
http://toolbox.uma.es/comunidad/
click
enter admin user data

create ToolboX theme


$ cp -r comunidad/qa-theme/SnowFlat/ comunidad/qa-theme/ToolboX/
$ scp ~/opt/toolboxumaes/qa/qa-styles.css
root@toolbox.uma.es:/var/www/html/comunidad/qa-theme/ToolboX/
$ scp ~/opt/toolboxumaes/qa/metadata.json
root@toolbox.uma.es:/var/www/html/comunidad/qa-theme/ToolboX/
$ scp ~/opt/toolboxumaes/qa/star.png
root@toolbox.uma.es:/var/www/html/comunidad/qa-theme/ToolboX/images/

## _decimal_point is not properly translated


$ sed -i -e 's/Punto decimal/./g'
/var/www/html/comunidad/qa-lang/es-ES/qa-lang-main.php

administración:
http://toolbox.uma.es/comunidad/index.php/admin/general

servidor de correo
https://hostpresto.com/community/tutorials/how-to-setup-an-email-server-on-centos7/
CentOS 7 server

descargar y quemar con dd


arrancar con pendrive y configurar teclado, red y usuarios

yum install -y nano wget


yum install -y httpd
systemctl start httpd
systemctl enable httpd
yum install -y mariadb mariadb-server
systemctl start mariadb
systemctl enable mariadb
mysql_secure_installation
enter
y
[pw]
y
y
y
y
yum install -y php php-mysql
systemctl restart httpd
wget http://prdownloads.sourceforge.net/webadmin/webmin-1.690-1.noarch.rpm
rpm -U webmin-1.690-1.noarch.rpm
systemctl disable firewalld
yum install -y iptables-services
systemctl enable iptables
nano /etc/sysconfig/iptables
(debajo de :OUTPUT ACCEPT [0:0])
-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 10000 -j ACCEPT
systemctl restart iptables

acceder a 150.214.108.118:10000 con root y pw

Servers - MySQL Database Server - module configuration


Command to start MySQL server = systemctl start mariadb
Command to stop MySQL server = systemctl stop mariadb
save
Apache configuration file: /etc/httpd/conf/httpd.conf

actualizar website
sftp root@150.214.108.118
sftp>put -r web/* /var/www/html/

scp -r ...

instalar certificado
yum install mod_ssl
nano /etc/httpd/conf.d/ssl.conf
modificar:
# Server Certificate:
# Server Private Key:
# Server Certificate Chain:

quitar SELinux
nano /etc/sysconfig/selinux
SELINUX=disabled
sestatus
FTP server

https://www.thegeekdiary.com/centos-rhel-how-to-configure-iptable-rules-to-all
ow-ftp-ports-2021/

1. Edit file /etc/sysconfig/iptables-config and add “ip_conntrack_ftp“” module


to the section “IPTABLES_MODULES=“. Entry should look like this:

$nano /etc/sysconfig/iptables-config

IPTABLES_MODULES="ip_conntrack_ftp"

2. Edit file /etc/sysconfig/iptables and make sure iptables rules are added
for port 20/21

$ nano /etc/sysconfig/iptables
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m tcp --dport 21 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 20 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
Note: Order of the iptables rules is important.
3. Restart iptables service

$service iptables restart

$ yum install vsftpd -y

## configure vsftpd to run at boot


$systemctl enable vsftpd

## status
$ iptables -nvL
TELNET server

https://www.unixmen.com/installing-telnet-centosrhelscientific-linux-6-7/

$yum install telnet telnet-server -y

$systemctl start telnet.socket


$systemctl enable telnet.socket

$ nano /etc/sysconfig/iptables
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m tcp --dport 21 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 20 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 23 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT

Note: Order of the iptables rules is important.

$service iptables restart


SSH KEY authentication

1. ​configuración del servidor CentOS


/sbin/service sshd start

lock pw access for root

# passwd -l root

unlock pw access for root

# passwd -u root

medidas de seguridad

nano /etc/ssh/sshd_config

PubkeyAuthentication yes
AuthorizedKeyFile .ssh/authorized_keys
PasswordAuthentication no
ChallengeResponseAuthentication no

service sshd reload

fail2ban
## activar fail2ban tras booting
systemctl enable fail2ban
## activar fail2ban
systemctl start fail2ban
## desactivar fail2ban
systemctl stop fail2ban

nano /etc/fail2ban/jail.local
## reiniciar tras cambiar configuración
systemctl restart fail2ban

"bantime" is the number of seconds that a host is banned.


bantime = 99999999

# A host is banned if it has generated "maxretry" during the last "findtime"


# seconds.
findtime = 600

# "maxretry" is the number of failures before a host get banned.


maxretry = 3

firewalld
## activar firewall tras booting
systemctl enable firewalld
## activar firewall
systemctl start firewalld
## desactivar firewall
systemctl stop firewalld

servicios de firewalld
## activar la zona que permite acceso de las páginas web a través del firewall
firewall-cmd --zone=public --add-service=http
## para activarlo tras booting
firewall-cmd --zone=public --permanent --add-service=http
## sudo firewall-cmd --zone=public --permanent --add-service=https
firewall-cmd --zone=public --permanent --add-port=8080/tcp
## sudo firewall-cmd --zone=public --permanent --add-service=https

## ver los servicios activados


firewall-cmd --list-services

nano /etc/fail2ban/jail.d/sshd.local
## reiniciar tras cambiar configuración
systemctl restart firewalld

check if the server has been compromised

stress test

2. ​configuración desde el cliente


cd ~/.ssh
ssh-keygen
toolbox
(sin pw)
ssh-copy-id -i ~/.ssh/id_rsa root@150.214....

ssh-add ~/.ssh/toolbox

ssh root@150.214....

==============================

mkdir .ssh
chmod 700 .ssh

ftp and copy id_rsa.pub to server ~/.ssh

cat id_rsa.pub >> ~/.ssh/authorized_keys


chmod 600 authorized_keys

restorecon -Rv ~/.ssh

## check configuration options


nano /etc/ssh/sshd_config

## restart and update config


systemctl restart ssh
monitor network traffic

$ yum -y install iftop

monitor network traffic and statistics

iptraf

$ yum install iptraf


$ iptraf-ng

monitorix
setup

# yum install epel-release -y


# yum install monitorix -y
configure
# nano /etc/monitorix/monitorix.conf

refresh_rate = ​60

<auth>
enabled = ​y
msg = ​ToolboX use statistics
htpasswd = /var/lib/monitorix/htpasswd

80 = HTTP, tcp, ​out​, 0, 1000, L

# tpasswd -cbd /var/lib/monitorix/htpasswd username passwd


# systemctl restart monitorix

cop
Install toolbox in centos

## convert deb to rpm


sudo alien -r /tmp/toolbox_1.0-189.deb /tmp
sudo yum install toolbox-1.0-190.noarch.rpm
wifi UMA (PDI)

desde móvil Android

MV
geb.uma.es 150.214.45.158
ipi.geb.uma.es 150.214.45.146
toolbox.uma.es 150.214.45.146

terminal with colored prompt


~/.bashrc
descomentar
#force_color_prompt=yes

if [ "$color_prompt" = yes ]; then


PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]
\[\033[01;34m\]\W\[\033[00m\]\$ '

SSH + public key


ssh-keygen
ssh-copy-id user@server // upload public key to bitbucket
ssh-add

configuración

~/.hgrc
[ui]
username=Francisco Vico <fjvico@uma.es>
ssh = ssh -C
[auth]
repo.prefix = https://bitbucket.org/umafoss/
repo.username = fjvico

opt/toolbox/.hg/hgrc
# example repository config (see "hg help config" for more info)
[paths]
default = https://fjvico@bitbucket.org/umafoss/toolbox

# path aliases to other clones of this repo in URLs or filesystem paths


# (see "hg help config.paths" for more info)
#
# default-push = ssh://jdoe@example.net/hg/jdoes-fork
# my-fork = ssh://jdoe@example.net/hg/jdoes-fork
# my-clone = /home/jdoe/jdoes-clone

[ui]
# name and email (local to this repository, optional), e.g.
# username = Jane Doe <jdoe@example.com>

setup SSH in bitbucket


https://confluence.atlassian.com/bitbucket/set-up-ssh-for-git-728138079.html#

change remote URL to repository


https://confluence.atlassian.com/bitbucket/change-the-remote-url-to-your-repository-794212774.html

add a public key to ssh agent


https://superuser.com/questions/988185/how-to-avoid-being-asked-enter-passphrase-for-key-when-im-doi
ng-ssh-operatio

Start ssh-agent if not started:


$ eval `ssh-agent -s`

Add your private key using ssh-add


$ ​ssh-add ~/.ssh/id_rsa
Enter passphrase for /home/user/.ssh/id_rsa:
Identity added: /home/user/.ssh/id_rsa
(/home/user/.ssh/id_rsa)

Check if the key is added (parameter is a lowercase L):


$ ssh-add -l
2048 55:96:1a:b1:31:f6:f0:6f:d8:a7:49:1a:e5:4c:94:6f
/home/user/.ssh/id_rsa_key (RSA)

browser search results with TAB


install ​extension
(full ​discussion​)

temperature sensors
sudo apt-get install lm-sensors
sudo sensors-detect
[sudo service kmod start]
sensors
 
install tor 
sudo add-apt-repository ppa:webupd8team/tor-browser
sudo apt-get update
sudo apt install tor-browser

lcc backoffice 
http://www.lcc.uma.es/backoffice

http://tipsonubuntu.com/2016/07/31/install-oracle-java-8-9-ubuntu-16-04-linux-mint-18/
sudo add-apt-repository ppa:webupd8team/java
sudo apt update; sudo apt install oracle-java8-installer
javac -version
sudo apt install oracle-java8-set-default

if security problems arise:


javaws -viewer
>> include ​www.lcc.uma.es​ in the white list (security tab)
 
descripción hardware y fan threshold 
http://linrunner.de/en/tlp/docs/tlp-linux-advanced-power-management.html#installation
$ uname -a
$ sudo lshw -short
$ lscpu
 
Keyboard a español 
setxkbmap -layout es
 
screencast (screen recording) 
​SimpleScreenRecorder

app >> Ubuntu repositories 


have it first in ​Debian​ (in your PPA) and get it synced from there

http://askubuntu.com/questions/16446/how-to-get-my-software-into-ubuntu
 
 
CRON 
VER ACTIVIDAD DE CRON
## CentOS 7
more /var/log/cron | tail -2
## Lubuntu
grep -i cron /var/log/syslog | tail -2

EDITAR CRONTAB
## usuario actual
crontab -e
## general del sistema (peligroso)
nano /etc/crontab

VER CRONTAB ACTIVOS


crontab -l

SHELL=/bin/bash
crontab en toolbox.uma.es

PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root

# For details see man 4 crontabs

# Example of job definition:


# */10 * * * * root /root/.local/bin/backuplogs >/dev/null
2>/dev/null | every 10 minutes
# 10 * * * * root /root/.local/bin/backuplogs >/dev/null
2>/dev/null | at 10 past
# .------------------------ minute (0 - 59)
# | .------------------- hour (0 - 23)
# | | .-------------- day of month (1 - 31)
# | | | .--------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR
sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * user-name command to be executed

# Update ToolboX ranking


*/10 * * * * root /root/.local/bin/backuplogs >/dev/null
2>/dev/null
# * * * * * root nice -n 20 /root/toolbox/makeranking
>/dev/null 2>/dev/null
   
install Lubuntu in HP Folio 
instalar ISO en pendrive con unetbootin, life con 2GB de persistence

iniciar
Esc
F9 -> boot options
UEFI - Kingston Data Traveler u otro nombre de fabricante
aparece menú blanco y negro > install Lubuntu
vico
folio (casa) / folio2 (despacho)

sudo apt-get update


sudo apt-get install mercurial
hg clone https://bitbucket.org/fjvico/lib/ .local/bin/

echo 'export PATH=$PATH:~/.local/bin/'


export PATH=$PATH:~/.local/bin/

sudo apt-get install redshift

[Desktop Entry]
Type=Application
Exec=<command to execute>

mv ~/.config/openbox ~/.config/openbox.back
clonar .config/ openbox fjvico fjvico
openbox --reconfigure

no usar:
Legacy - (Kingston Data Traveler u otro nombre de fabricante)
aparece menú azul > Install Lubuntu
dr

usb speakers 
sudo apt install pavucontrol
>> built-in audio off

install ISO - GUADALINEX SLIM / NEXT


Run the following command, replacing /dev/sdx with your drive, e.g. /dev/sdb. (do not append a partition
number, so do not use something like /dev/sdb1):

(sin formatear el pendrive)

slim / next
sudo dd bs=4M if=guadalinexedu-nextslim-instalador-centros-2016122201.iso of=/dev/sdb
status=progress && sync

guadalinex 2013
sudo dd bs=4M if=guadalinexedu-2013-instalador-centros.iso of=/dev/sdb status=progress && sync

espeak
sudo apt-get install espeak mbrola mbrola-es1 mbrola-es2

time synchronization at UMA


sudo apt install ntpdate
sudo ntpdate ​-u​ pool.ntp.org
(se va a retirar pronto en favor de ​timedatectl​)

>> /etc/rc.local ?

particionar pendrive

sudo fdisk /dev/sdb


>p
>n
>p
>1
> [Intro]
> +2G
>p
>w

formatear pendrive

sudo gparted
create partition table
create primary partition
format as ms-dos

sudo fdisk -l # identificar dispositivo


sudo umount /dev/sdXX # XX = dispositivo: b1 / c1
sudo mkdosfs -F 32 -I /dev/sdXX # formatear como FAT32
sudo mkfs.vfat -I /dev/sdX

particionar y Live en Linux


formatear y crear live en windows​ > ​LiLi

impresoras LCC 
## install CUPS
sudo apt-get update
sudo apt-get install cups
sudo /etc/init.d/cups restart

## add network printers


System Tools >> printers >>
add >> ipp://172.16.51.68 >> HP >> Laserjet 3015 (centro)
add >> ipp://172.16.51.74 >> HP >> Laserjet 3015 (ventana)

lubuntu 
 
Mac Mini 
Instalación:  insertar  pen  de  instalación  y  mantener  presionada  la  tecla  Alt  para  entrar  en  setup  cuando 
aparece la pantalla blanca; seleccionar EFI Boot y después “Instalar Lubuntu”. 
 
Para  evitar  la  pantalla  negra  y  el error: con las flechas situarse sobre instalar lubuntu y presionar ‘e’ para 
editar  parámetros  de  boot,  añadir  ‘nomodeset’  al  final  de  la  línea  larga  (antes  de  “---”)  y  presionar  F10 
para boot. 
 
digital clock​: %a %d %b %R = Fri 16 Jul 15:22 
 
printer 

sudo apt-get install cups

sudo /etc/init.d/cups restart

system > printers > add 


 
 
chrome en Lubuntu 16.04 
 
descargar en https://www.google.com/chrome/browser/desktop/index.html 
abrir con Package Installer > Install Package 
 
 
otras formas 
 
sudo wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - 
 
sudo  sh  -c  'echo  "deb  http://dl.google.com/linux/chrome/deb/  stable  main"  >> 
/etc/apt/sources.list.d/google.list' 
 
sudo apt-get update 
 
sudo apt-get install google-chrome-stable 
   
SSH 
sudo apt-get update 
sudo apt-get install openssh-server 
sudo ufw allow 22 
 
sudo start ssh 
sudo stop ssh 
 
múltiples workspaces 
falta stdio.h y build-essentials tiene dependencias 
 
 
 
   
autocomplete for linux command line 
 
bind '"\e[A":history-search-backward' 
 
 
installación de Google Drive 
 
copiar ​drive​ (7.8MB) en /usr/bin y hacer ejecutable 
sudo mv ~/Downloads/drive /usr/bin 
sudo chmod +x /usr/bin/drive 
 
drive init /home/fjvico 
 
# “pull” trae de drive al HD (tirar hacia abajo, desde la nube) 
# “push” lleva del HD a drive (empujar arriba, hacia la nube) 
drive pull ~/Projects # actualiza el directorio local Projects 
drive push ~/Projects # actualiza el directorio Projects de drive 
 
 
Compilar fuentes en GO 
 
sudo apt-get install golang git mercurial 
go get github.com/rakyll/drive 
go get github.com/odeke-em/drive 
 
 
 
instalar fuentes de GO 
 
From Source 
 
Dependencies 
 
sudo apt-get update 
sudo apt-get install gcc make mercurial git libc6-dev 
 
Building from source 
 
hg clone -u release https://code.google.com/p/go 
cd go/src 
./all.bash 
 
The GOPATH environment variable 
 
export GOPATH=$HOME/go 
export PATH=$PATH:$GOPATH/bin 
 
 
 
añadir variables a /etc/environment 
export GOROOT=/usr/local/go 
export PATH=$PATH:$GOROOT/bin 
export GOPATH=$HOME/go 
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin 
instalar drive 
go get github.com/rakyll/drive/cmd/drive 
go get github.com/odeke-em/drive 
uso 
drive help 
 
convertir texto a imagen 
 
convert -list font | more 
 
convert  -background  white  -fill  black  -font  Webdings-Regular  -pointsize  72  -gravity  center  label:"Y" 
-monochrome text.bmp 
 
 
auth file ​~/.hgrc 
[auth] 
bb.prefix = https://bitbucket.org/fjvico/ 
bb.username = fjvico 
bb.password = 1+ 
 
 
Extract flac from cue 
 
# instalar shnsplit 
sudo apt-get install cuetools shntool flac 
 
# split 
cuebreakpoints file.cue | shnsplit -o flac file.flac 
 
# tag tracks 
cuetag file.cue split*.flac 
 
   
instalar Mercurial 
 
https://confluence.atlassian.com/bitbucket/set-up-mercurial-726371757.html 
 
copias de seguridad en cada sitio de trabajo 
 
crear ~/.hgrc con 
 
[auth]
bb.prefix = https://bitbucket.org
bb.username = fjvico
bb.password = <password>
 
 
poner el fichero ​00_update​ en ​/etc/pm/sleep.d/​ como ejecutable y este contenido: 
 
#!/bin/bash 
 
case "$1" in 
hibernate | suspend ) 
hg -R /home/fjvico/Code/toolbox add -X /home/fjvico/Code/toolbox/**~ 
hg -R /home/fjvico/Code/toolbox commit -S --addremove -m "hpcasa" -u fjvico >> tmp/update.log 
  hg  -R  /home/fjvico/Code/toolbox  push  -S  -u  https://fjvico@bitbucket.org/fjvico/toolbox  >> 
tmp/update.log 
;; 
thaw | resume ) 
  hg  -R  /home/fjvico/Code/toolbox  pull  https://fjvico@bitbucket.org/fjvico/toolbox  >> 
tmp/update.log 
;; 
esac 
 
 
subir 
echo "hg add -R ~/Code/toolbox -X **~" > ~/subir
echo "hg commit --addremove -R ~/Code/toolbox -m \"hpLCC\" -u fjvico" >> ~/subir
echo "hg push-R ~/Code/toolbox https://fjvico:claveteo@bitbucket.org/fjvico/toolbox" >> ~/subir
chmod +x subir
 
bajar 
echo "hg pull -u -R ~/Code/toolbox https://fjvico:claveteo@bitbucket.org/fjvico/toolbox"1 > ~/bajar
chmod +x bajar

1
 
architecture of the system / Linux version 
lscpu 
 
uname -i 
uname -a # long version 
   
have more workspaces 
 
gsettings set org.compiz.core:/org/compiz/profiles/unity/plugins/core/ vsize 3 
gsettings set org.compiz.core:/org/compiz/profiles/unity/plugins/core/ hsize 3 
 
 
mlterm as default terminal 
sudo update-alternatives --config x-terminal-emulator 
 
brillo y color de pantalla (dimmer) 
 
instalar redshift 
 
dimmer.sh 
 
#!/bin/bash

if [ $# -eq 0 ]; then
redshift -o -l 40.41:-3.69 > /dev/null
exit
fi
if [ $# -eq 1 ]; then
TEMPERATURE=100
else
TEMPERATURE=$2
fi

## first argument controls brightness


## 1.0 : maximum brightness
## 0.1 : minimum brightness

BRIGHTNESS=$(echo "scale=2;$1/100" | bc -l)

## second argument (optional) controls color temperature


## 1.0 = 6500K
## 0.0 = 3700K

MAXTEMP=6500
MINTEMP=3700

TEMPERATURE=$(echo "-($MAXTEMP-$MINTEMP)*($TEMPERATURE-100)/100+$MINTEMP" | bc)


redshift -b $BRIGHTNESS -t $TEMPERATURE:$TEMPERATURE -o -l 40.41:-3.69 > /dev/null
 
 
 
Instalar UBUNTU 14.04.01 
 
descargar 
instalar 
- abrir el ​ISO​ (con rar, p.e.) y copiar el contenido en el pen drive 
(mac  mini:  insertar  pen  de  instalación  y  mantener  presionada  la  tecla  Alt  para  entrar  en  setup  cuando 
aparece la pantalla blanca; seleccionar USB windows, no EFI Boot) 
 
lo que hay que hacer tras instalar Trusty Tahr 
http://howtoubuntu.org/things-to-do-after-installing-ubuntu-14-04-trusty-tahr 
 
 
 
sudo apt-get update 
 
 
instalar driver WIFI: 
sudo update-pciids 
sudo apt-get install firmware-b43-installer 
sudo reboot ) 
 
tras seleccionar “install ubuntu” aparece: 
 
Installation type 
- Install Ubuntu alongside them 
- Erase disk and install Ubuntu 
- ... 
- Something else 
 
select “Something else” 
 
particionar disco 
● Primary Partition - ​1Gb​ (1024Mb) of Free Space - bootstrap files, boot loaders and stuff you'll may need to run 
multiple operating systems 

/boot 

● Extended Partition 
○ 10Gb (10240Mb) - swap 
(0.5% is not much, and 10Gb is double the memory size of typical 4Gb system) 
swap 
○ 30Gb (30960Mb) - root / 
(for Ubuntu system files and applications) 

○ 100Gb (102400Mb) - /home 
(system/application dependent config, data and other files) 
/home 
● 1850Gb free for another operating system, your system-independent media files, virtual machines and stuff 

Actualizar Ubuntu 14 

cuando lo pida el actualizador automático 

Format a USB drive

Method #2 (The Command-Line Way)

In case you can't get your device formatted from ​Method #1​ try this way. 

1. Open the Terminal (​Ctrl​ + ​Alt​ + ​T​) 


2. List your block storage devices by issuing the command ​lsblk
3. Then identify your pen drive by it's SIZE. In my case its ​/dev/sdb

4.
5. Erase everything in the pen drive ​(OPTIONAL)​: 
6. sudo dd if=/dev/zero of=/dev/sdb bs=4k && sync
7. Replace ​/dev/sdb​ with your corresponding device. This will take some time. It will pretend to 
stuck. Just be patient. 
8. Make a new partition table in the device: 
9. sudo fdisk /dev/sdb
○ Then press letter ​o​ to create a new empty DOS partition table. 
10. Make a new partition: 
○ Press letter ​n​ to add a new partition. You will be prompted for the size of the 
partition. Making a primary partition when prompted, if you are not sure. 
○ Then press letter ​w​ to write table to disk and exit. 
11. Format your new partition. 
○ See what is your new partition with a command ​lsblk
○ In my case it is ​/dev/sdb1

12.
○ Issue the command below to format the new volume: 
○ sudo mkfs.vfat /dev/sdb1
○ Please replace ​/dev/sdb1​ with your corresponding device. 
○ Eject the device: 
○ sudo eject /dev/sdb

Make bootable USB 

Install UNetbootin in Ubuntu 

sudo add-apt-repository ppa:gezakovacs/ppa

sudo apt-get update

sudo apt-get install unetbootin

ejecutar

sudo /usr/bin/unetbootin 

_____ 
make bootable USB of ubuntu from Linux 

Chrome 

http://askubuntu.com/a/79284 

sudo apt-get install libxss1 libappindicator1 libindicator7 


wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb 
sudo apt-get install -f 
sudo dpkg -i google-chrome*.deb 

update chrome 
sudo apt-get update 
sudo apt-get --only-upgrade install google-chrome-stable 
sudo pkill -15 google-chrome 
sudo pkill -15 chrome 
 

Launcher 

gsettings set com.canonical.Unity.Launcher favorites "['application://nautilus.desktop', 'unity://running-apps', 


'application://gnome-terminal.desktop', 'unity://expo-icon', 'unity://devices', 'application://google-chrome.desktop']" 

suspend (14.04) 

dbus-send --system --print-reply --dest="org.freedesktop.UPower" /org/freedesktop/UPower


org.freedesktop.UPower.Suspend

Hibernate 

sudo -i

cd /var/lib/polkit-1/localauthority/50-local.d/
gedit com.ubuntu.enable-hibernate.pkla

Copy and paste below lines into the file and save it. 

[Re-enable hibernate by default in upower] 


Identity=unix-user:* 
Action=org.freedesktop.upower.hibernate 
ResultActive=yes 
 
[Re-enable hibernate by default in logind] 
Identity=unix-user:* 
Action=org.freedesktop.login1.hibernate 
ResultActive=yes 
 

Hibernate your laptop when lid is closed: 

1.Edit “/etc/systemd/logind.conf” via command: 

sudo gedit /etc/systemd/logind.conf 

2. Change the line #HandleLidSwitch=suspend to HandleLidSwitch=hibernate and save the file. 

3. Run command below or just restart your computer to apply changes: 

sudo restart systemd-logind 

Java 

sudo add-apt-repository ppa:webupd8team/java 


sudo apt-get update 
sudo apt-get install oracle-java8-installer 
 

Octave 

sudo apt-add-repository ppa:octave/stable 

sudo apt-get update 


sudo apt-get install octave 

configure gedit for octave syntax 

sudo gedit /usr/share/gtksourceview-3.0/language-specs/objc.lang 

delete the ​*.m​ in ​<property name="globs">*.m</property> 

copy JSONLAB 

sudo cp -a /path/to/jsonlab /usr/share/octave/<version>/m 

addpath /usr/share/octave/<version>/m/jsonlab 

savepath 

Speed test 

wget -O speedtest-cli https://raw.github.com/sivel/speedtest-cli/master/speedtest_cli.py 

chmod +x speedtest-cli 

./speedtest-cli 

Pendiente 

activar workspaces 

menus en ventana propia 

 
 
   
Mercurial 
 
cd /path/of/repository
hg init
hg add -X **~
hg status
hg commit --addremove -m "first upload" -u fjvico
... # create repository in bitbucket
hg push https://fjvico:C1@bitbucket.org/fjvico/toolbox # update cloud clone
...
hg pull -u https://fjvico:C1@bitbucket.org/fjvico/toolbox # update local clone
 
 
 
subir 
echo "hg add -R ~/opt/toolbox -S -X **~" > ~/.local/bin/subir
echo "hg commit --addremove -R ~/opt/toolbox -S -m hpcasa -u fjvico" >>
~/.local/bin/subir
echo "hg push -R ~/opt/toolbox https://fjvico@bitbucket.org/fjvico/toolbox" >>
~/.local/bin/subir
chmod +x ~/.local/bin/subir
 
 
bajar 
echo "hg pull -u -R ~/opt/toolbox https://fjvico@bitbucket.org/fjvico/toolbox" >
~/.local/bin/bajar
chmod +x ~/.local/bin/bajar
 
 
   
 
Download videos: ​youtube-dl 
 
 
COMPARTIR WIFI 
http://ubuntuhandbook.org/index.php/2014/09/3-ways-create-wifi-hotspot-ubuntu/ 
 
Añadir Julia a Geany 
 
How to add limited Julia highlight: Linux 
 
SEE: geany custom-filetypes 
 
#434 thread by @getzze 
https://groups.google.com/forum/#!topic/julia-users/tisM_9sKPCc 
https://github.com/JuliaLang/IJulia.jl/blob/master/deps/julia.js 
https://github.com/JuliaLang/julia/blob/71c0aa3e5660258af5c042058d5d8d3b82d93efb/contrib/julia.h
rc 
keywords from pygment lexer (http://pygments.org/) 
 
Add a Julia filetypes.Julia.conf 
 
create  a  file:  filetypes.Julia.conf  in  /usr/share/geany/filetypes.Julia.conf  in  to  the  users  geany  config 
folder 
 
To get the User config dir: 
Geany > Help > Debug Messages: User config dir: e.g. /home/username/.config/geany 
 
Copy the text into it / adjust if needed 
 
# filetypes.Julia.conf 

# For complete documentation of this file, please see Geany's main documentation 
# based on  
# https://groups.google.com/forum/#!topic/julia-users/tisM_9sKPCc 
# https://github.com/geany/geany/issues/434  
# https://github.com/JuliaLang/IJulia.jl/blob/master/deps/julia.js 

https://github.com/JuliaLang/julia/blob/71c0aa3e5660258af5c042058d5d8d3b82d93efb/contrib/julia.h
rc 
# keywords from pygment lexer (http://pygments.org/) 

# Very limited support for julia based on the Matlab filetypes.matlab: 20150317 peter1000 
[styling=Matlab/Octave] 
 
[keywords] 
# all items must be in one line 
# keywords from pygment lexer (http://pygments.org/) 
primary=abstract  baremodule  begin  bitstype  break  catch  ccall  const  continue  do  else  elseif  end  export 
finally  for  function  global  if  immutable  import  importall  in  let local macro module quote return try type 
typealias using while 
#secondary=exit  whos  edit  load  is  isa  isequal  typeof  tuple  ntuple  uid  hash  finalizer  convert  promote 
subtype  typemin  typemax  realmin  realmax  sizeof  eps  promote_type  method_exists  applicable  invoke 
dlopen dlsym system error throw assert new Inf Nan pi im 
#identifiers=Bool  Int  Int8  Int16  Int32  Int64  Uint  Uint8 Uint16 Uint32 Uint64 Float32 Float64 Complex64 
Complex128 Any Nothing None 
 
[settings] 
# use builtin lexer for Matlab 
lexer_filetype=Matlab/Octave 
tag_parser=Matlab 
 
# default extension used when saving files 
extension=jl 
 
# single comments, like # in this file 
comment_single=# 
# multiline comments 
#comment_open=#= 
#comment_close==# 
 
[indentation] 
width=4 
# 0 is spaces, 1 is tabs, 2 is tab & spaces 
type=0 
 
 
[build_settings] 
# %f will be replaced by the complete filename 
# %e will be replaced by the filename without extension 
# (use only one of it at one time) 
compiler= 
run_cmd=julia "%f" 
 
 
Add Julia to: filetype_extensions.conf (/home/username/.config/geany/filetype_extensions.conf) 
 
Geany > Tools > Configuration Files > filetype_extensions.conf 
 
add a line: 
Julia=*.jl; 
 
add Julia to the [Groups] 
Programming=Julia;Clojure;CUDA;Cython;Genie;Go;Rust;Scala; 
   
 
 
 
Toolbox live 
 
Octave 
sudo apt-add-repository ppa:octave/stable 
sudo apt-get update 
sudo apt-get install octave 
 
editor 
sudo apt-get install gedit (tarda bastante) 
geany 
 
eliminar menu bar en geany: en libmain.c, mirar main_init(void) 
o activar ​global menu 
 
jsonlab 
sudo cp -a /path/to/jsonlab /usr/share/octave/<version>/m 
addpath /usr/share/octave/4.0.2/m/jsonlab 
savepath 
 
autorun 
crear un fichero .desktop en ~/.config/autostart (crear este directorio si no existe) 
[Desktop Entry] 
Type=Application 
Exec=ToolboX.sh 
Hidden=false 
NoDisplay=false 
X-GNOME-Autostart-enabled=true 
Name=Startup Script 
 
cd /usr/local/bin 
sudo ToolboX.sh 
sudo chmod +x Toolbox.sh 
sudo gedit ToolboX.sh 
 
copiar en gedit 
#!/bin/bash 
setxkbmap -layout es 
xmodmap -e “keycode 67 =” #desactivar F1 
xmodmap -e “keycode 68 =” #desactivar F2 
xmodmap -e “keycode 69 =” #desactivar F3 
xmodmap -e “keycode 70 =” #desactivar F4 
xmodmap -e “keycode 71 =” #desactivar F5 
xmodmap -e “keycode 72 =” #desactivar F6 
xmodmap -e “keycode 73 =” #desactivar F7 
xmodmap -e “keycode 74 =” #desactivar F8 
xmodmap -e “keycode 75 =” #desactivar F9 
xmodmap -e “keycode 76 =” #desactivar F10 
xmodmap -e “keycode 95 =” #desactivar F11 
xmodmap -e “keycode 96 =” #desactivar F12 
xmodmap -e “keycode 171 =” #desactivar Fn+F12 
xmodmap -e “keycode 133 =” #desactivar tecla Windows 
xmodmap -e “keycode 134 =” #desactivar tecla Fn-Windows 
xmodmap -e “keycode 37 =” #desactivar tecla Control izq 
xmodmap -e “keycode 105 =” #desactivar tecla Control der 
xmodmap -e “keycode 64 =” #desactivar tecla Alt 
xmodmap -e “keycode 108 =” #desactivar tecla Alt-Gr 
… 
lxterminal --working-directory=”/home/lubuntu/Documents/ToolboX” 
--command=”/home/lubuntu/Documents/ToolboX/ToolboX.m maths_4ESO” 
exit 
 
eliminar cabecera de ventanas 
~/.config/openbox/lubuntu-rc.xml 
include in the <applications> section: 
 
<applications> 
<application class="*"> 
<decor>no</decor> 
</application> 
... 
 
ventanas en laterales 
~/.config/openbox/lubuntu-rc.xml 
include in the <applications> section: 
 
<!-- Allocate 'lxterminal' in the left half--> 
<application name="lxterminal"> 
<position> 
<x>0</x> 
<y>0</y> 
</position> 
<maximized>Vertical</maximized> 
</application> 
 
<!-- Allocate 'gedit' in the right half--> 
<application name="gedit"> 
<position> 
<x>-0</x> 
<y>0</y> 
</position> 
<maximized>Vertical</maximized> 
</application> 
 
1 desktop 
<desktops> 
... 
<number>1</number> 
… 
<name>ToolboX</name> 
</desktops> 
 
remove taskbar 
~/.config/lxpanel/Lubuntu/panels/panel 
At the very top of the file, in the General section, you can modify these parameters 
 
autohide=1 
heightwhenhidden=0 
 
terminar sesión 
gnome-session-quit # logout 
shutdown ‘now’ 
 
bloquear teclas 
xmodmap -e “keycode <dec_num> = ” 

F1 67

F10 76
F11 95
F12 96

xmodmap -e “keycode 95 = ” # desactiva F11 


Create a file in your home folder called .xinitrc with
touch .xinitrc
and place in it:
xmodmap ~/.Xmodmap

xmodmap 
keysyms​ recognized by Tk 
 
touchpad: ​synclient
synclient TouchPadOff=1
 
teclas - identificar keycode 
xev
 
cómo identificar una ventana 
 
   
screen coordinates 
 
man X 
 
GEOMETRY SPECIFICATIONS
One of the advantages of using window systems instead of hardwired terminals is that applications
don't have to
be restricted to a particular size or location on the screen. Although the layout of windows on a
display is
controlled by the window manager that the user is running (described below), most X programs
accept a command
line argument of the form -geometry WIDTHxHEIGHT+XOFF+YOFF (where WIDTH, HEIGHT, XOFF,
and YOFF are numbers)
for specifying a preferred size and location for this application's main window.

The WIDTH and HEIGHT parts of the geometry specification are usually measured in either pixels or
characters,
depending on the application. The XOFF and YOFF parts are measured in pixels and are used to
specify the dis-
tance of the window from the left or right and top and bottom edges of the screen, respectively.
Both types of
offsets are measured from the indicated edge of the screen to the corresponding edge of the window.
The X off-
set may be specified in the following ways:

+XOFF The left edge of the window is to be placed XOFF pixels in from the left edge of the screen
(i.e., the
X coordinate of the window's origin will be XOFF). XOFF may be negative, in which case the
window's
left edge will be off the screen.

-XOFF The right edge of the window is to be placed XOFF pixels in from the right edge of the
screen. XOFF
may be negative, in which case the window's right edge will be off the screen.

The Y offset has similar meanings:

+YOFF The top edge of the window is to be YOFF pixels below the top edge of the screen (i.e., the
Y coordi-
nate of the window's origin will be YOFF). YOFF may be negative, in which case the window's
top edge
will be off the screen.

-YOFF The bottom edge of the window is to be YOFF pixels above the bottom edge of the screen.
YOFF may be
negative, in which case the window's bottom edge will be off the screen.

Offsets must be given as pairs; in other words, in order to specify either XOFF or YOFF both must be
present.
Windows can be placed in the four corners of the screen using the following specifications:

+0+0 upper left hand corner.


-0+0 upper right hand corner.

-0-0 lower right hand corner.

+0-0 lower left hand corner.

In the following examples, a terminal emulator is placed in roughly the center of the screen and a
load average
monitor, mailbox, and clock are placed in the upper right hand corner:

xterm -fn 6x10 -geometry 80x24+30+200 &


xclock -geometry 48x48-0+0 &
xload -geometry 48x48-96+0 &
xbiff -geometry 48x48-48+0 &
   
 
CHOMPER (website blocker) 
 
$ sudo apt-get install curl

$ curl -sL
https://raw.githubusercontent.com/aniketpanjwani/chomper_installers/master/debian.sh
| bash && source ~/.bashrc 
 
 

S-ar putea să vă placă și