Translate

martes, febrero 19, 2019

Como trabajar a diario con github

Subir archivos de proyecto local a github publico


Guia:
1 Empezar a trabajar,ir a la carpeta donde tenemos el proyecto cd /carpera:

1.$git init
2.$git add .
3.$git commit -m “version1.0″
4.$git remote add origin https://github.com/usuario/repositorio
5.$git remote -v
6.$git push origin master
Explicación:

En este tutorial voy a explicar como subir los archivos de tu carpeta local a tu repositorio de Github. Para eso es importante seguir los siguientes pasos:
Instala Git Bash en tu computadora utilizando la terminal. Lo puedes descargar del siguiente link: https://git-scm.com/downloads
Ingresa a www.github.com y crea un repositorio publico en tu cuenta de Github.


Abre la terminal y navega con el comando “cd” a la carpeta de tu proyecto.
Dentro de tu proyecto escribe: $git init
Agrega los archivos a tu nuevo repositorio local utilizando el siguiente comando (no olvides el punto después de “add”): $git add .

Para entender el siguiente paso, es necesario entender el significado de “commit”. Commit es un comando que va creando distintas versiones del proyecto. Conforme vayamos avanzando, creando nuevos archivos y mejorando el proyecto, podemos ir guardando las distintas versiones en github, para esto será necesario que hagamos un commit cada ves que queramos crear una nueva versión. Utilizando el siguiente código: $git commit -m “version1.0″
Ahora, es necesario en la terminal ir al repositorio git (la carpeta del proyecto) y estando dentro pegar el siguiente código: $git remote add origin https://github.com/usuario/repositorio
Ahora, es necesario poner el siguiente código: $ git remote -v
El ultimo paso escribir en la terminal: $ git push origin master


2 Subir las modificaciones para actualizar un remositorio:


git add .
git config --global user.email "tu@cuentaGithup.org"
 git commit -m "version1.1"
git remote -v
git fetch
git push origin master

Si queremos añadir un nuevo archivo y que lo siga ejecutaremos este comando para agregarlo al repositorio:
git add -f NuevoFichero

viernes, febrero 15, 2019

activar Proxy en la shell de Linux

Set http_proxy shell variable on Linux/OS X/Unix bash shell

Type the following command to set proxy server:
$ export http_proxy=http://server-ip:port/
$ export http_proxy=http://127.0.0.1:3128/
$ export http_proxy=http://proxy-server.mycorp.com:3128/

If the proxy server requires a username and password then add these to the URL. For example, to include the username foo and the password bar:
$ export http_proxy=http://foo:bar@server-ip:port/
$ export http_proxy=http://foo:bar@127.0.0.1:3128/
$ export http_proxy=http://USERNAME:PASSWORD@proxy-server.mycorp.com:3128/

How do I setup proxy variable for all users?

To setup the proxy environment variable as a global variable, open /etc/profile file:
# vi /etc/profile
Add the following information:
export http_proxy=http://proxy-server.mycorp.com:3128/
OR
export http_proxy=http://USERNAME:PASSOWRD@proxy-server.mycorp.com:3128/
Save and close the file.

A note about enabling proxy access to a specific user

To enable proxy access for a specific user, add the lines user shell profile. For the default bash shell, the profile is the file .bash_profile. For example, enable proxy access for a specifc user called vivek, type:
$ vi $HOME/.bash_profile
OR
# vi /home/vivek/.bash_profile
Append the following line:
export http_proxy=http://USERNAME:PASSOWRD@proxy-server.mycorp.com:3128/
Save and close the file.

How do I use password protected proxy server using various command line options?

You can simply use wget command as follows:
$ wget --proxy-user=USERNAME --proxy-password=PASSWORD http://path.to.domain.com/some.html
Lynx command has the following syntax:
$ lynx -pauth=USER:PASSWORD http://domain.com/path/html.file
Curl command has following syntax:
$ curl --proxy-user user:password http://url.com/

domingo, noviembre 18, 2018

How to access iPhone with iOS 11 in Linux

How to access iPhone (6s) with iOS 11 in Linux


A couple of years ago, I wrote a detailed tutorial on iPhone mount & use compatibility in Linux across multiple distributions. KDE/Plasma struggled with this the most, not seeing and/or not mounting the device automatically. But we did have a relatively neat solution in the form of idevice and ifuse utilities, with some command line hacking.
With the release of iOS 11 (and possibly one version earlier) things seem to have changed somewhat. And I have only run and tested iPhone 6 with iOS 8/9. To wit, here's another tutorial to help you work around this. At the moment, I have an iPhone 6s model for testing, and I cannot guarantee this method will work well with newer models, but overall, the procedure should be identical for the rest of the Apple smartphone range. Anyway, after me.
Teaser

Tools of the trade

This guide aims specifically at Plasma use, however, we will cover all angles. It is applicable across the distro range. The only difference is in the subset of libraries and tools you will need to install. This guide has been compiled working with Kubuntu 17.10, so it works for any Ubuntu-based (and maybe even Debian) system. If you're wondering how to achieve this in other distros, like Fedora, please take a look at my guide detailing exactly this - iPhone connectivity in Fedora KDE. The principles are identical.
Let's begin with the necessary extras - the set of libraries is very similar to what we did in the past, except some tools have new, incremented versions. Nothing too dramatic:
sudo apt-get install ideviceinstaller python-imobiledevice libimobiledevice-utils libimobiledevice6 libplist3 python-plist ifuse usbmuxd

Connect iPhone

The next step is to connect your device and make sure it's recognized. You can check this with dmesg, and look for an output similar to this:
[ ] usb 2-3: new high-speed USB device number 4 using ehci-pci
[ ] usb 2-3: New USB device found, idVendor=05ac, idProduct=12a8
[ ] usb 2-3: New USB device strings: Mfr=1, Product=2 ...
[ ] usb 2-3: Product: iPhone
[ ] usb 2-3: Manufacturer: Apple Inc.
[ ] usb 2-3: SerialNumber: 42aed16e758bde7cb268 ...
[ ] ipheth 2-3:4.2: Apple iPhone USB Ethernet device attached
[ ] usbcore: registered new interface driver ipheth

Open console

Now, let's try the pair command - which is most likely going to fail:
No device found
idevicepair pair
No device found, is it plugged in?
What you need to do next is run the usbmuxd command. This is a socket daemon to multiplex connections from and to iOS devices. Normally, it should run as a background service, which we will enable later, but for now, open a separate terminal, and as sudo or root, run:
usbmuxd -f -v
The console should fill in with text, which is good. Now, in a separate console window, let's go back to trying to pair the device. As before, we will need to unlock the iPhone and trust the laptop:
idevicepair pair
SUCCESS: Paired with device 421c580dfa7ba121f591b1aed14a657bde7cb268

Mount device

Now, create a mount point, something like media/iPhone. Make it accessible to everyone with chmod 777 or make your user the owner of the directory so you can access it without root permissions in the file manager. Then, mount with ifuse:
sudo mkdir /media/iPhone
sudo chown : /media/iPhone
ifuse /media/iPhone/
Open the file manager (Dolphin) and navigate to the mount point.
iPhone mounted

Cosmetics

For easier future access, you can now drag & drop the location shortcut into the sidebar, and even add a custom icon and/or name. Then, every time you mount an iPhone, you can easily go there, and if there's no device mounted, no harm done.
Shortcut
iPhone mounted, nice icon
You can script the mount and umount procedures if you wish. Likewise, the same applies to the usbmuxd service, which you may want to be running with your system. You can enable it to run on startup - and if you get an ugly systemd error, then just "manually" start it when needed or every time the desktop logs through Plasma settings. Either one is fine.

systemctl enable usbmuxd
systemctl start usbmuxd 


When you want to unmount, do the following two lines
fusermount -u /media/iPhone/
idevicepair unpair


lunes, septiembre 24, 2018

x96 tv box, instalar un servidor proxy squid

Configuración del proxy squid:

1.modificar /etc/squid/squid.conf:

#Recommended minimum configuration:
acl manager proto cache_object
acl localhost src 127.0.0.1/32
acl to_localhost dst 127.0.0.0/8
acl localnet src 0.0.0.0/8 192.168.100.0/24 192.168.101.0/24
acl SSL_ports port 443
acl Safe_ports port 80   # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 # gss-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling http

acl CONNECT method CONNECT

http_access allow manager localhost
http_access deny manager
http_access deny !Safe_ports

http_access deny to_localhost
icp_access deny all
htcp_access deny all

http_port 3128

#Aqui definimos la salida de los logs,
#podemos poner la salida a una MicroSD
access_log /etc/squid/log/access.log squid
cache_log /etc/squid/log/cache.log

#Suggested default:
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern . 0 20% 4320
# Leave coredumps in the first cache dir
coredump_dir /var/spool/squid3

# Allow all machines to all sites

http_access allow all


2.Crear el directorio  /etc/squid/log/ y cambiar de propietario a proxy:

chown -Rv proxy:proxy  /etc/squid/log/

3. Podemos reinicar el servicio squid "service squid restart" y configurar un navegador,
con  tail -f  /etc/squid/log/access.log vemos como funciona el proxy

3-para una vista visual de la navegacion en el proxy:
   primero instalar apache: apt install apache2
   segundo: seguir tutorial:
https://www.tecmint.com/sarg-squid-analysis-report-generator-and-internet-bandwidth-monitoring-tool/

4- Los logs generados pesan bastante sobre todo access.log, squid tiene una funcion para rotar los logs:
    4.1 :Editamos /etc/logrotate.d/squid y ponemos la hubicación correcta de los logs (/etc/squid/log/)
     4.2: Usamos crontab para llamar a logrotate y borrar logs de mas de 10 dias:
                #Rotado diario de logs squid
                #Todos los dias a las 23:55
                 55 23  * * *  su -l root -c '/usr/sbin/logrotate /etc/logrotate.conf  -f'
                 #Borramos todos aquellos logs *.gz que tienen mas de 10 dias


                55 23  * * *  su -l root -c '/usr/bin/find /etc/squid/log/*.gz -mtime +10 -type f -exec rm -f \{\} \;'