domingo, 6 de março de 2022

Montando dispositivos Androids automaticamente em Linux (Xubuntu)

Após fazer diversos testes e seguir diversos tutoriais não obtive sucesso. Então foram instalados diversos pacotes que a principio não são necessários (como por exemplo jmtpfs, mtp-tools etc). Tive sucesso instalando: sudo apt-get install gvfs-backends Após instalar, reiniciei o computador e ao plugar o celular pela USB em modo de TRANSFERENCIA DE ARQUIVO e MODO DE DEPURAÇÃO USB ativado, automaticamente o THUNAR mountou uma unidade dando acesso ao armazenamento interno do celular.

quinta-feira, 30 de julho de 2020

Untracking a local file on GIT

To untrack files in local repository but keep at origin, as our scenario needed; to keep folder or files in git origin repository but untrack any local changes made in this folder, You can use “git update-index –assume-unchanged”. This will enable new developers to get all the files in the repository when cloning. The application can make all the changes it wants in the specified folder, but locally they won’t be committed an pushed to the origin. The only minor problem with this solution is that you have to do this on every new machine that clones the repo. But something positive that comes out of this is that when you need to update files in the untracked folder you can.

1. Preparing the repo

Make sure you add the folder with all the containing files(that you later want to untrack) to the repo. And then commit and push it to your origin. In this example my folder is named Library.






git add -- .
git commit -a -m 'adding library folder'
git push

2. Add this folder to .gitignore







/library/*





And then commit this update. If you need more information about how to use the .gitignore file you can look at git online documentation.
At this stage the folder library and its contents are still tracked by git. Any changes to a file in this folder will therefor be marked as changed still. Lets take care of that next.

3. Untrack files in local repository but keep at origin

Now run the following command to untrack the library folder and its contents:






git update-index --assume-unchanged library/*

Make a change to a file in this folder and git will assume it has not been changed, so you won’t commit anything in this folder.

4. Undo this change

Say you need to update a file in the library folder after a while. Then you need only one command to start track this folder again:






git update-index --no-assume-unchanged library/*

5. Make alias of these commands

If you like you can create aliases for these commands to something simpler:






git config --global alias.assume-unchanged 'update-index --assume-unchanged'
git config --global alias.assume-changed 'update-index --no-assume-unchanged'

This makes you able to run:






git assume-unchanged library/*

and:






git assume-changed library/*

domingo, 26 de julho de 2020

Como arrumar LARAVEL erro 500 - Olhando os arquivos de LOG

É comum tentar acessar o site feito em LARAVEL e retornar com ERRO 500 sem nenhuma informação se é erro de configuração, do servidor, de permissão de arquivos...

A forma mais certeira de consertar o erro 500 é descobrir o que está causando. Para isso basta olhar nos arquivos de LOGs que podem estar espalhados em vários locais.


  • Primeiro procure pelo arquivo "log_error" dentro da pasta "public"
  • Outra opção é procurar pelo mesmo arquivo "log_error" da pasta raiz do LARAVEL
  • Está dificil! Sendo assim tem mais um arquivo de log dentro da pasta /storage/logs
  • Por fim, parece não ser um erro do LARAVEL e sim do servidor... (permissão de arquivos, ou versão errada do PHP, ou outro)... Então, vá no CPANEL e olhe o log do PHP.

chmod recursivo para arquivos e diretórios em servidor http

Muitas vezes ao fazer o upload de arquivos e diretórios para servidores, as permissões de acesso são modificadas e fazem com que retornem erro, por por exemplo em servidor HTTP retorne erro 500.

Normalmente os arquivos são configurados com permissão 644 e diretórios com permissão 755.

Uma forma fácil de atualizar tudo e de forma recursiva é acessar o servidor por SSH e executar os seguintes comandos (executar o comando um nível abaixo do diretorio "meusite"):

find meusite/ -type d -exec chmod 755 {} \;
find meusite/ -type f -exec chmod 644 {} \;

terça-feira, 18 de junho de 2019

Como descobrir a minha versão e distribuição linux?

Para descobrir a sua versão e distribuição do linux é fácil:
Basta abrir o terminal e digitar:

cat /etc/os-release


terça-feira, 8 de janeiro de 2019

Como montar um HD secundário automaticamente ao iniciar o Linux (Ubuntu/Xubuntu)

Eu sempre tenho o GPARTED instalado. Com ele é a forma mais fácil de identificar qual partição queremos montar.



No caso eu quero montar a partição /dev/sdb7 no ponto /media/juliano/Teco e essa é uma partição do tipo NTFS.

Sendo assim:

sudo nano /etc/fstab

Ao abrir o editor Nano, vá até a última linha e adicione o seguinte comando:

/dev/sdb7 /media/juliano/Teco ntfs defaults 0 0

Salve e feche o editor (CTRL+X)

E então finalize executando o seguinte comando:
sudo mount -a

segunda-feira, 25 de junho de 2018

Adicionando os repositórios do RASPBIAN ao KALI LINUX para Raspberry Pi

Após instalar o KALI LINUX no Raspberry Pi 3, notei que não era possível instalar vários pacotes utilizando o comando apt-get install.
Para solucionar esse problema, adicionei o repositório do RASPBIAN na lista de repositórios do KALI.

  • Criar um novo arquivo /etc/apt/sources.list.d/raspbian.list
  • Adicionar essas duas linha (Fonte: https://www.raspbian.org/RaspbianRepository)
    • deb http://archive.raspbian.org/raspbian wheezy main contrib non-free
    • deb-src http://archive.raspbian.org/raspbian wheezy main contrib non-free 
  • Executar o seguinte comando para adicionar a chave pública do repositório:
    • wget https://archive.raspbian.org/raspbian.public.key -O - | sudo apt-key add -
  • Atualizar o APT:
    •  sudo apt update