remove metadata file with linux terminal





install package
Terminal:
sudo apt-get install id3v2
check metadata just now
Terminal:
id3v2 -l some_file.mp3
erease metada
Terminal:
id3v2 -s some_file.mp3
erease metada
Terminal:
id3v2 -s some_file.mp3

all files a folder
Terminal:
for i in *.mp3; do echo "Processing $i"; id3v2 -s "$i"; done


Fuente: https://askubuntu.com/questions/26911/erase-and-rewrite-mp3-id3-tags


0 comentarios :

mysql varius sentences





  1. I see all foreign keys to a table or column: SELECT TABLE_NAME,COLUMN_NAME,CONSTRAINT_NAME, REFERENCED_TABLE_NAME,REFERENCED_COLUMN_NAME FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE REFERENCED_TABLE_NAME = '<table>'
  2. Distinc values in 2 columns from 2 tables:SELECT
     SELECT DISTINCT t1.`ID_POSTULANTE` AS T1_ID_POSTULANTE FROM
      `tb_postulante` t1 INNER JOIN `aulaasignada` as t2
       ON t1.`ID_POSTULANTE` != t2.`ID_POSTULANTE`
       GROUP BY T1_ID_POSTULANTE
  3. values duplicate for one column: SELECT certificado_id_correlativo FROM t_certificado_digital group by certificado_id_correlativo having count(*) >= 2
  4. update from select: update tabla1 inner join tabla2 on tabla1.id_tabla2 = tabla2.id set tabla1.campo=tabla2.language
  5. update year sales: update sales set created_at=DATE_FORMAT(created_at, '2020-%m-%d') where YEAR(created_at) < 2020 ;
  6. update month sales: update sales set created_at=DATE_FORMAT(created_at, '%y-10-%d') where MONTH(created_at) < 10 ;
  7. update day sales: update sales set created_at=DATE_FORMAT(created_at, '%y-%m-25') where DAY(created_at) < 10 and MONTH(created_at) = 10 ;
  8. update month invertval sales: update sales set created_at=date_add(created_at, interval 1 month);
  9. insert select:
    1. INSERT INTO generic_stage.entity_items (
          client_id,
          item_type_id,
          item_id,
          action_type,
          action_result,
          marketing_flag,
          creation_timestamp
      )
      SELECT
          '300001' AS client_id,
          8 AS item_type_id,
          cg.id AS item_id,
          1 AS action_type,
          1 AS action_result,
          0 AS marketing_flag,
          NOW() AS creation_timestamp -- use NOW() for current timestamp
      FROM generic_source.item_source cg
      WHERE source_provider_id = 7;











source:

0 comentarios :

arch and manjaro temp size









create this script and run:


Terminal:
#!/bin/bash

sudo mount -o remount,size=40G,noatime /tmp
echo "Done. Please use 'df -h' to make sure folder size is increased."


source: https://gist.github.com/ertseyhan/618ab7998bdb66fd6c58
















0 comentarios :

how create service linux repeat each 10s






Terminal:
nano /etc/systemd/system/test.service


[Unit]                                                                                                                                            
Description=test_job                                                                                                                              
                                                                                                                                                  
[Service]                                                                                                                                         
Type=oneshot                                                                                                                                      
ExecStart=/usr/bin/php /tmp/run.php 




Terminal:
nano /etc/systemd/system/test.timer

[Unit]                                                                                                                                            
Description=test                                                                                                                                  
                                                                                                                                                  
[Timer]                                                                                                                                           
OnUnitActiveSec=10s                                                                                                                               
OnBootSec=10s                                                                                                                                     
                                                                                                                                                  
[Install]                                                                                                                                         
WantedBy=timers.target


Terminal:
systemctl daemon-reload

Terminal:
systemctl start test.timer

Terminal:
systemctl list-timers --all

Source:

https://unix.stackexchange.com/questions/198444/run-script-every-30-min-with-systemd


0 comentarios :

docker sonarqube laravel





how run docker sonarqube:
Terminal:
docker run -d --name sonarqube sonarqube


descargar el sonar client:
https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner

unzip
Terminal:
unzip sonar-scanner-cli-*

Terminal:
sudo cp -a sonar-scanner-* /opt/

Terminal:
sudo chmod -R 775 /opt/sonar-scanner-*

Terminal:
sudo ln -s /opt/sonar-scanner-3.2.0.1227-linux/bin/sonar-scanner /bin/sonar-scanner

edit values default
Terminal:
sudo nano /opt/sonar-scanner-3.2.0.1227-linux/conf/sonar-scanner.properties



# Required metadata
sonar.projectKey=testproject
sonar.projectName=testproject
sonar.projectVersion=1.0.0

# Path to the parent source code directory.
sonar.sources=app

# Language
# We've commented this out, because we want to analyse both PHP and Javascript
#sonar.language=php

# Encoding of the source code
sonar.sourceEncoding=UTF-8

# Reusing PHPUnit reports
sonar.php.coverage.reportPath=ci/codeCoverage/codeCoverage.xml
sonar.php.tests.reportPath=ci/testResults.xml

# Here, you can exclude all the directories that you don't want to analyse.
# As an example, I'm excluding the Providers directory
sonar.exclusions=app/Providers/**

# Additional parameters
#sonar.my.property=value




add config your proyect in the file sonar-project.properties


# Required metadata
sonar.projectKey=project1
sonar.projectName=project1
sonar.projectVersion=1.0.0

# Path to the parent source code directory.
sonar.sources=app

# Language
# We've commented this out, because we want to analyse both PHP and Javascript
sonar.language=php

# Encoding of the source code
sonar.sourceEncoding=UTF-8

# Reusing PHPUnit reports
sonar.php.coverage.reportPath=ci/codeCoverage/codeCoverage.xml
sonar.php.tests.reportPath=ci/testResults.xml

# Here, you can exclude all the directories that you don't want to analyse.
# As an example, I'm excluding the Providers directory
sonar.exclusions=vendor/**

# Additional parameters
#sonar.my.property=value


run in your proyect


Terminal:
sonar-scanner -e -X


1 comentarios :

how run ireport v5.6.0 o JasperReports in GNU/LINUX jdk 7




first install jdk7 in your system

Terminal:
sudo apt-get install jdk7-openjdk



download ireport
 https://community.jaspersoft.com/project/jasperreports-library/releases

now you run with jdk7
Terminal:
./ireport --jdkhome "/usr/lib/jvm/java-7-jdk/"


it is all :)





0 comentarios :

how block visibility only articles

















0 comentarios :

how Simply selecting a Gimp layer




Edit > Preferences > Tool Options > Set Layer or Path as active









0 comentarios :

how to connect your home server to a domain with cloudflare


this tutorial is very extend for has various points:

  1. Add site
  2. Auto update your dynamic ip 
  3. Add sub-domains to domain
  4. Select to type of encryption
  5. Configuration encryption pem and key with nginx


well cloudflare is a server dns that allows you to manage our dns for free for the domains we use and create sub-domains, although it has more cloudflare tools, we will use some of them


after you register:

1. Add the site











select plan to use: 





when you finalize the purchase for 0$ you can see that:

press to button continue


now you must change dns nameserver in your domain 



for example in my domain  https://my.freenom.com/




change to Name-servers



to







check the name-servers is working






2. Auto update your dynamic ip

if you have a dynamic ip, you need send the new ip to cloudflare for this use a small script bash for run with crontab in Gnu/Linux the best system :)

well for this we looking 3 elements
 a) api key


 b) id zone dns (for domain)


 c) id domain in zone dns

now we use curl and api for get the id domain 
https://api.cloudflare.com/

list dns records
https://api.cloudflare.com/#dns-records-for-a-zone-list-dns-records

get the attribute id and use after dns_record at url

Terminal:
curl -X GET "https://api.cloudflare.com/client/v4/zones/YOUR_ZONE_ID/dns_records?type=A&name=YOUR_DOMAIN" -H "X-Auth-Email: YOUR_EMAIL" -H "X-Auth-Key: YOUR_API_KEY" -H "Content-Type: application/json"

you remember get the id of your domain example ramdontest.ml, the others are sub-domain and we interest update only the domain because the sub-domain has the same ip, because use dns type CNAME 


update the ip

Terminal:
curl -X PUT "https://api.cloudflare.com/client/v4/zones/YOUR_ZONE_ID/dns_records/YOUR_ID_DOMAIN" \
     -H "X-Auth-Email: user@example.com" \
     -H "X-Auth-Key: YOUR_API_KEY" \
     -H "Content-Type: application/json" \
     --data '{"type":"A","name":"example.com","content":"127.0.0.1","ttl":1,"proxied":false}'
the word or number with red is because you change 1 to 120 or true - false, for balance with cloudflare or without balance


script bash

Terminal:
#!/bin/sh
ipNow=$(/sbin/ifconfig enp2s0 | grep -i 'Direc. inet' | cut -d ":" -f 2 | cut -d " " -f 1)
ipOld=""
UBICATION_LOGS="/opt/logs/"
ejecutarCodigo() {
 {
  echo "From: Server Update IP <server@YOUR-DOMAIN.COM>"
  echo "Sender: YOUR-MAIL@GMAIL.COM"
  echo "To: YOUR-MAIL@GMAIL.COM"
  echo "Subject: The server change ip"
  echo
  echo "The server change ip "$ipOld" to "$ipNow
 } | /usr/sbin/ssmtp YOUR-MAIL@gmail.com #enviar email
}
while read line; do
 ipOld=$line 
done <$UBICATION_LOGS"ipOld.js"
echo $ipOld"  -  "$ipNow
if [ $ipOld != $ipNow ]; then
 #loadwebs.tk
 curl -X PUT "https://api.cloudflare.com/client/v4/zones/YOUR_ID_ZONE/dns_records/YOUR_ID_DOMAIN" \
  -H "X-Auth-Email: YOUR-MAIL@gmail.com" \
  -H "X-Auth-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{"type":"A","name":"YOUR_DOMAIN","content":'\"$ipNow\"',"ttl":1,"proxied":false}' 
 ejecutarCodigo
else
 echo "NO"
fi




3. Add sub-domains to domain

Add the sub-domain


this is very important, change the domain to dns only, this is you can connect for ssh with domain or you can a sub-domain change to dns only and connect to ssh


Example:








4. Select to type of encryption

These options are listed from least (Off) to most secure (Full SSL (Strict)). All options are available in all customer plans.

Off: No secure connection between your visitor and Cloudflare, and no secure connection between Cloudflare and your web server either. This means that visitors can only view your website over HTTP, and any visitor attempting to connect via HTTPS will receive a HTTP 301 Redirect to the plain HTTP version of your website.


Flexible SSL: A Secure connection between your visitor and Cloudflare, but no secure connection between Cloudflare and your web server. You don't need to have an SSL certificate on your web server, but your visitors still see the site as being HTTPS enabled. This option is not recommended if you have any sensitive information on your website. This setting will only work for port 443->80, not for the other ports we support like 2053. It should only be used as a last resort if you are not able to setup SSL on your own web server. Be aware it can cause issues when you decide to switch away from it: How do I fix the infinite redirect loop...


Full SSL: A secure connection between your visitor and Cloudflare, plus a secure connection (but not authenticated) between Cloudflare and your web server. You will need to have your server configured to answer HTTPS connections, with at least a self-signed certificate. The authenticity of the certificate is not verified: from Cloudflare’s point of view (when we connect to your origin web server), it’s the equivalent of bypassing this error message. But as long as the address of your origin web server is correct in your DNS settings, you know that we’re connecting to your web server, and not someone else’s.

Full SSL (Strict): A secure connection between your visitor and Cloudflare, plus a secure and authenticated connection between Cloudflare and your web server. You will need to have your server configured to answer HTTPS connections, with a valid SSL certificate. This certificate must be signed by a certificate authority that is trusted by Cloudflare, have an expiration date in the future, and respond for the request domain name (hostname). If you've added a CNAME record for the hostname on Cloudflare, the certificate's Common Name or SAN may also match the CNAME target.

Strict (SSL-Only Origin Pull): Enterprise only This mode has the same certificate requirements as Full (Strict) and will also upgrade all connections between Cloudflare and the origin from HTTP to HTTPS, even if the original content requested is over HTTP.

Origin CA certificates, generated by Cloudflare, can be used with either the Full or Full(strict) options as they are trusted by Cloudflare. You can find more information about Origin CA certificates below:



if you want use Flexible SSL dont need config more, whole is ready.


now configuration with full mode




select to full mode




create certificate





copy the code pem and code key and paste in your server

you should have this










5. Configuration encryption pem and key with nginx



Terminal:
server {
 listen 443 ssl;
 server_name first.ramdontest.ml;
 root /var/www;
 index index.php index.html index.htm index.nginx-debian.html;
 ssl_certificate        /opt/ssl/ramdontest.pem;
 ssl_certificate_key    /opt/ssl/ramdontest.key;
 access_log /opt/logs/ramdontest.ml.access_log.js;
 error_log /opt/logs/ramdontest.ml.error_log.js;
 rewrite_log on;
 location / {
  proxy_pass http://localhost:3202;
  proxy_http_version 1.1;
  proxy_set_header Upgrade $http_upgrade;
  proxy_set_header Connection 'upgrade';  
 }
}


links: https://support.cloudflare.com/hc/en-us/articles/200170416-What-do-the-SSL-options-mean-

1 comentarios :

virtualbox manjaro error /sbin/vboxconfig solved kernel 4.14



first check to version kernel

Terminal:
uname -a 



my kernel is 4.14.* for this, i install

Terminal:
sudo pacman -S linux414-virtualbox-host-modules

now activate modprobe

Terminal:
sudo modprobe vboxdrv

Terminal:
sudo adduser your_home_user vboxusers

Terminal:
sudo usermod -aG vboxusers your_home_user

that's all






0 comentarios :

how create modules, controllers, plugin block drupal 8.54






i recomend use a docker-compose with drupal what have configuration ready to create modules

if you use native apache run install composer and install drupal console with


  • Download composer
    Terminal:
    php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
  • Install Composer
    Terminal:
    php composer-setup.php
  • Copy composer to local bin
    Terminal:
    cp -a composer.phar /usr/local/bin/composer
  • Install git
    Terminal:
    apt-get update -y && apt-get install git-core -y

  • Install console with composer
  • Terminal:
    composer require drupal/console:~1.0 --prefer-dist --optimize-autoloader
  • Install drush with composer
  • Terminal:
    composer global require drush/drush && \
        composer global update

or with docker easy run that install whole before
Terminal:
sudo docker-compose up




now run this

Use this command:

Terminal:
vendor/bin/drupal generate:module


For generate a controller:
Terminal:
vendor/bin/drupal generate:controller


for generate plugin block:
Terminal:
vendor/bin/drupal generate:plugin:block
Remenber write to name module






0 comentarios :

start drupal 8.54 or 7.59 with docker









import!! first check this post



configuration for drupal 8.54


Repository:


Repository:



start with 

Terminal:
sudo docker-compose up

stop with

CTRL+C or

Terminal:
sudo docker-compose stop












0 comentarios :

how to resize multiple to image Ubuntu/Manjaro

Ubuntu
Terminal:
sudo apt-get install imagemagick

Manjaro
Terminal:
sudo pacaman -S imagemagick

Note: that commands are in your folder

resize mode default
Terminal:
convert *.jpg -resize 500x500 -quality 100 foto.jpg

resize mode force
Terminal:
convert *.jpg -resize 500x500! -quality 100 foto.jpg


Reducing the file size of a very large images, without changing the image dimensions
first create a folder tmp same level to dictory
Terminal:
mkdir ../tmp

resize all elements jpg to directory
Terminal:
for i in *.jpg; do convert "$i" -quality 40  ../tmp/"$i"; done

up a directory and check to diff
Terminal:
du -smh * | sort -h


Fuente:
https://www.imagemagick.org/discourse-server/viewtopic.php?t=21324



0 comentarios :

docker openvpn ubuntu 16.04











first create a variable for assign the name volume docker

Terminal:
OVPN_DATA="ovpn-data-example"

we create to volume
Terminal:
docker volume create --name $OVPN_DATA

run the docker specif the domain of you server
Terminal:
docker run -v $OVPN_DATA:/etc/openvpn --rm kylemanna/openvpn ovpn_genconfig -u udp://VPN.SERVERNAME.COM
generate certificates
Terminal:
docker run -v $OVPN_DATA:/etc/openvpn --rm -it kylemanna/openvpn ovpn_initpki

start the vpn process
Terminal:
docker run -v $OVPN_DATA:/etc/openvpn -d -p 1194:1194/udp --cap-add=NET_ADMIN kylemanna/openvpn

create client without password
Terminal:
docker run -v $OVPN_DATA:/etc/openvpn --rm -it kylemanna/openvpn easyrsa build-client-full CLIENTNAME nopass

create client with password
Terminal:
docker run -v $OVPN_DATA:/etc/openvpn --rm -it kylemanna/openvpn easyrsa build-client-full CLIENTNAME

insert the configuration client the file

Terminal:
docker run -v $OVPN_DATA:/etc/openvpn --rm kylemanna/openvpn ovpn_getclient CLIENTNAME > CLIENTNAME.ovpn


full command
Terminal:
OVPN_DATA="ovpn-data-server" && CLIENTNAME=phone && sudo docker run -v $OVPN_DATA:/etc/openvpn --log-driver=none --rm -it kylemanna/openvpn easyrsa build-client-full $CLIENTNAME nopass && sudo docker run -v $OVPN_DATA:/etc/openvpn --log-driver=none --rm kylemanna/openvpn ovpn_getclient $CLIENTNAME > $CLIENTNAME.ovpn && cp $CLIENTNAME.ovpn /tmp/



client android or windows with openvpn application

client linux

Terminal:
sudo apt-get install openvpn


actually the client linux have a bug is necessary specif comp-lzo no
Terminal:
sudo openvpn --config CLIENTNAME.ovpn --comp-lzo no

connect without redirect
Terminal:
sudo openvpn --config CLIENTNAME.ovpn --comp-lzo no --pull-filter ignore redirect-gateway


or with gui client










client configuration no route all traffic through vpn server

remove this in file:
Terminal:
redirect-gateway def1

add this in file:

Terminal:
pull-filter ignore "dhcp-option DNS"
pull-filter ignore "route"
route-nopull
route 10.0.0.0 255.255.0.0



cliente connect check






0 comentarios :