Friday, November 20, 2015
Ubuntu copy and past (ctrl+c & ctrl+v) multi dimension
http://www.faqforge.com/linux/copy-and-paste-multiple-entries-ubuntu-linux/
Tuesday, October 27, 2015
How to colorify GIT
Add the following tags to your ~/.gitconfig file:
[color] diff = auto status = auto branch = auto interactive = autoFrom https://glance-stage.cern.ch/wiki/doku.php?id=git:configuration
Friday, October 16, 2015
How to create terminal alias / shortcuts / hotkeys
Edit the file:
vim ~/.bashrc
add the aliases. Mine were:
. ~/.bashrc
From:
http://githowto.com/aliases
http://askubuntu.com/questions/17536/how-do-i-create-a-permanent-bash-alias
Add alias auto completion:
Now its time for adding the auto completion to your alias:
wget https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash
mv git-completion.bash .git-completion.bash
vim .bash_profile
Add the following content to the file:
# add alies auto completion
source ~/.git-completion.bash
__git_complete gch _git_checkout
__git_complete gb _git_branch
__git_complete gmn _git_merge
Now just reboot shell and enjoy your auto completion :)
From:
http://stackoverflow.com/questions/342969/how-do-i-get-bash-completion-to-work-with-aliases
vim ~/.bashrc
add the aliases. Mine were:
alias gs='git status' alias ga='git add' alias gb='git branch' alias gc='git commit' alias gca='git commit --amend' alias gd='git diff' alias gdc='git diff --cached' alias gch='git checkout' alias gl='git lg1' alias gpl='git pull' alias gps='git push' alias gpssu='git push --set-upstream' alias gmn='git merge --no-ff' alias grh='git reset HEAD'
Windows
alias gsh='git show HEAD'
Linux
function gsh() { git show HEAD$1 } function lucas() { cd /srv/lucas$1 } function dev() { cd /srv$1 }Execute the file to make the changes work:
. ~/.bashrc
From:
http://githowto.com/aliases
http://askubuntu.com/questions/17536/how-do-i-create-a-permanent-bash-alias
Add alias auto completion:
Now its time for adding the auto completion to your alias:
wget https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash
mv git-completion.bash .git-completion.bash
vim .bash_profile
Add the following content to the file:
# add alies auto completion
source ~/.git-completion.bash
__git_complete gch _git_checkout
__git_complete gb _git_branch
__git_complete gmn _git_merge
Now just reboot shell and enjoy your auto completion :)
From:
http://stackoverflow.com/questions/342969/how-do-i-get-bash-completion-to-work-with-aliases
Friday, August 28, 2015
How to create a linux bash script to automatic ssh
Install sshpass software
Create an executable file YOUR_FILE.sh, with the following content:
#!/bin/bash
sshpass -p "YOUR_PASSWORD" ssh -o StrictHostKeyChecking=no YOUR_USERNAME@SERVER_ADDRESS
Make it executable
sudo chmod +x <filename>
Now just execute:
./YOUR_FILE.sh
sudo apt-get install sshpass
Create an executable file YOUR_FILE.sh, with the following content:
#!/bin/bash
sshpass -p "YOUR_PASSWORD" ssh -o StrictHostKeyChecking=no YOUR_USERNAME@SERVER_ADDRESS
Make it executable
sudo chmod +x <filename>
Now just execute:
./YOUR_FILE.sh
Wednesday, August 26, 2015
Thursday, July 30, 2015
Features installed on Firefox
Firebug
https://addons.mozilla.org/en-US/firefox/addon/firebug/?src=search
Clear Cache
https://addons.mozilla.org/en-US/firefox/addon/clearcache/?src=search
https://addons.mozilla.org/en-US/firefox/addon/firebug/?src=search
Clear Cache
https://addons.mozilla.org/en-US/firefox/addon/clearcache/?src=search
Wednesday, July 29, 2015
Tuesday, July 28, 2015
Monday, June 1, 2015
Autotype AutoKey Hotkey Ubuntu 14.04
http://askubuntu.com/questions/280604/assign-hotkeys-to-paste-predefined-text
Friday, May 22, 2015
How to download music MP3 from youtube
youtube-dl --extract-audio --prefer-ffmpeg --audio-format mp3 https://www.youtube.com/watch?v=wgEK6g8LsR4
Tuesday, March 17, 2015
Configuring / Customizing Sublime Text 3
Change tab switch feature, from smart predict way to Next Previous way
Add this to your user's key Binding file:
{ "keys": ["ctrl+tab"], "command": "next_view" },
{ "keys": ["ctrl+shift+tab"], "command": "prev_view" }
From https://www.sublimetext.com/forum/viewtopic.php?f=3&t=777
Working remotly:
http://wbond.net/sublime_packages/sftp/usage
How to install Sublime Linter
https://www.youtube.com/watch?v=u6fvJRao-E4
How to install PHP Code Sniffer
On terminal:
sudo apt-get install php-codesniffer
Then, run "which phpcs" to get the path to the phpcs installation
On sublime:
Open command palette (ctrl+shift+p) and install phpcs.
Then, go to: Preferences > Package Settings > PHP Code Sniffer > Settings - User
And add the path to the phpcs installation. My configuration was the following:
{
"phpcs_php_path": "/usr/bin/phpcs"
}
Install the DocBlockr
via Package Control
More info on https://packagecontrol.io/packages/DocBlockr
PHP Code formatting:
via Package Control
Install CodeFormatter, PHPfmt.
On the default phpfmt settings (Preferences -> Package Settings -> phpfmt -> Settings - Default), configure:
{
"format_on_save": false
}
On the default CodeFormatter settings (Preferences -> Package Settings -> CodeFormatter -> Settings - Default), configure php options:
"codeformatter_php_options":
{
"syntaxes": "php", // Syntax names which must process PHP formatter
"php_path": "/usr/bin/php7.0", // Path for PHP executable, e.g. "/usr/lib/php" or "C:/Program Files/PHP/php.exe". If empty, uses command "php" from system environments
"format_on_save": true, // Format on save
"php55_compat": false, // PHP 5.5 compatible mode
"psr1": false, // Activate PSR1 style
"psr1_naming": false, // Activate PSR1 style - Section 3 and 4.3 - Class and method names case
"psr2": false, // Activate PSR2 style
"indent_with_space": 4, // Use spaces instead of tabs for indentation
"enable_auto_align": true, // Enable auto align of = and =>
"visibility_order": false, // Fixes visibility order for method in classes - PSR-2 4.2
"smart_linebreak_after_curly": false, // Convert multistatement blocks into multiline blocks
// Enable specific transformations. Example: ["ConvertOpenTagWithEcho", "PrettyPrintDocBlocks"]
// You can list all available transformations from command palette: CodeFormatter: Show PHP Transformations
"passes": [
"AlignDoubleArrow",
"AlignDoubleSlashComments",
"AlignEquals",
"AlignGroupDoubleArrow",
"AlignTypehint",
"AllmanStyleBraces",
"OrderAndRemoveUseClauses"
],
// Disable specific transformations
"exclude": []
},
If you need to update from php 5.5 to 7.0:
To update your php to 7.0, follow this tutorial: here
Sublime Multi Selection commands:
Undo last selection
ctrl+u
Skip this selection and select next:
ctrl+k, ctrl+d
From: http://stackoverflow.com/questions/12411850/sublimetext-unselect-last-incrementally-selected-element
Other useful hotkeys (to be added at Preferences > Key Bindings - User):
Fence Logger:
{ "keys": ["ctrl+shift+l"], "command": "insert_snippet", "args": {"contents": "\\Fence\\Logger::info();"}}
From: http://stackoverflow.com/questions/15582210/sublime-text-how-to-make-shortcut-for-inserting-text
Alignment:
Install Alignment through Package Manager,
On the settings user (Preferences > Package Settings > Alignment > Settings - User), edit it as following:
{
"alignment_chars": ["=", "=>", ":"],
"alignment_space_chars": ["=", "=>", ":"]
}
Done. Ctrl+alt+a to align!
Add this to your user's key Binding file:
{ "keys": ["ctrl+tab"], "command": "next_view" },
{ "keys": ["ctrl+shift+tab"], "command": "prev_view" }
From https://www.sublimetext.com/forum/viewtopic.php?f=3&t=777
Working remotly:
http://wbond.net/sublime_packages/sftp/usage
How to install Sublime Linter
https://www.youtube.com/watch?v=u6fvJRao-E4
How to install PHP Code Sniffer
On terminal:
sudo apt-get install php-codesniffer
Then, run "which phpcs" to get the path to the phpcs installation
On sublime:
Open command palette (ctrl+shift+p) and install phpcs.
Then, go to: Preferences > Package Settings > PHP Code Sniffer > Settings - User
And add the path to the phpcs installation. My configuration was the following:
{
"phpcs_php_path": "/usr/bin/phpcs"
}
Install the DocBlockr
via Package Control
More info on https://packagecontrol.io/packages/DocBlockr
PHP Code formatting:
via Package Control
Install CodeFormatter, PHPfmt.
On the default phpfmt settings (Preferences -> Package Settings -> phpfmt -> Settings - Default), configure:
{
"format_on_save": false
}
On the default CodeFormatter settings (Preferences -> Package Settings -> CodeFormatter -> Settings - Default), configure php options:
"codeformatter_php_options":
{
"syntaxes": "php", // Syntax names which must process PHP formatter
"php_path": "/usr/bin/php7.0", // Path for PHP executable, e.g. "/usr/lib/php" or "C:/Program Files/PHP/php.exe". If empty, uses command "php" from system environments
"format_on_save": true, // Format on save
"php55_compat": false, // PHP 5.5 compatible mode
"psr1": false, // Activate PSR1 style
"psr1_naming": false, // Activate PSR1 style - Section 3 and 4.3 - Class and method names case
"psr2": false, // Activate PSR2 style
"indent_with_space": 4, // Use spaces instead of tabs for indentation
"enable_auto_align": true, // Enable auto align of = and =>
"visibility_order": false, // Fixes visibility order for method in classes - PSR-2 4.2
"smart_linebreak_after_curly": false, // Convert multistatement blocks into multiline blocks
// Enable specific transformations. Example: ["ConvertOpenTagWithEcho", "PrettyPrintDocBlocks"]
// You can list all available transformations from command palette: CodeFormatter: Show PHP Transformations
"passes": [
"AlignDoubleArrow",
"AlignDoubleSlashComments",
"AlignEquals",
"AlignGroupDoubleArrow",
"AlignTypehint",
"AllmanStyleBraces",
"OrderAndRemoveUseClauses"
],
// Disable specific transformations
"exclude": []
},
If you need to update from php 5.5 to 7.0:
To update your php to 7.0, follow this tutorial: here
Sublime Multi Selection commands:
Undo last selection
ctrl+u
Skip this selection and select next:
ctrl+k, ctrl+d
From: http://stackoverflow.com/questions/12411850/sublimetext-unselect-last-incrementally-selected-element
Other useful hotkeys (to be added at Preferences > Key Bindings - User):
Fence Logger:
{ "keys": ["ctrl+shift+l"], "command": "insert_snippet", "args": {"contents": "\\Fence\\Logger::info();"}}
From: http://stackoverflow.com/questions/15582210/sublime-text-how-to-make-shortcut-for-inserting-text
Alignment:
Install Alignment through Package Manager,
On the settings user (Preferences > Package Settings > Alignment > Settings - User), edit it as following:
{
"alignment_chars": ["=", "=>", ":"],
"alignment_space_chars": ["=", "=>", ":"]
}
Done. Ctrl+alt+a to align!
Friday, March 13, 2015
Ubuntu 14.04 LTS USB not working (autosuspending)
To correct this, execute the following commands on terminal:
sudo su
sudo su
for foo in /sys/bus/usb/devices/*/power/level;
do echo on > $foo;
done
Extracted from http://askubuntu.com/questions/80638/how-to-disable-auto-power-off-of-usb-devices-like-usb-mouse
Wednesday, March 11, 2015
Solve Ubuntu 14.04 LTS network suspending problem
To solve this problem, create a script file as bellow:
sudo gedit
With the following content:
sudo chmod +777
It's done!
Tutorial extracted from http://askubuntu.com/questions/452826/wireless-networking-not-working-after-resume-in-ubuntu-14-04
sudo gedit
etc/pm/sleep.d/script.sh
With the following content:
#!/bin/sh
case "${1}" in
resume|thaw)
nmcli nm sleep false
;;
esac
Now make it executable:sudo chmod +777
etc/pm/sleep.d/script.sh
It's done!
Tutorial extracted from http://askubuntu.com/questions/452826/wireless-networking-not-working-after-resume-in-ubuntu-14-04
How to create a Wifi network with Ubuntu 14.04
First of all, install the app-hotspot (before start it, read this entire LucasTipss tutorial):
http://www.edivaldobrito.com.br/como-criar-hotspot-wi-fi-portatil-para-celulares-android-windows-no-ubuntu/
Now, there's a bug with ubuntu 14.04 LTS. To fix it, follow the bellow steps. The solution is a downgrade of the system. (extracted from http://www.webupd8.org/2013/06/how-to-set-up-wireless-hotspot-access.html)
http://www.edivaldobrito.com.br/como-criar-hotspot-wi-fi-portatil-para-celulares-android-windows-no-ubuntu/
Now, there's a bug with ubuntu 14.04 LTS. To fix it, follow the bellow steps. The solution is a downgrade of the system. (extracted from http://www.webupd8.org/2013/06/how-to-set-up-wireless-hotspot-access.html)
Fot 64-bit:
cd /tmp
wget http://archive.ubuntu.com/ubuntu/pool/universe/w/wpa/hostapd_1.0-3ubuntu2.1_amd64.deb
sudo dpkg -i hostapd*.deb
sudo apt-mark hold hostapd
For 32-bit:
cd /tmp
wget http://archive.ubuntu.com/ubuntu/pool/universe/w/wpa/hostapd_1.0-3ubuntu2.1_i386.deb
sudo dpkg -i hostapd*.deb
sudo apt-mark hold hostapd
Wednesday, January 28, 2015
SSH Commands
Upload a folder via ssh:
scp -r /var/www/html/fence-tutorial/* atglance@lxplus.cern.ch:~/www/stage-lucas/fence-tutorial
Download a folder
scp -r lvieirag@sub:/srv/lucas/ .
scp -r /var/www/html/fence-tutorial/* atglance@lxplus.cern.ch:~/www/stage-lucas/fence-tutorial
Download a folder
scp -r lvieirag@sub:/srv/lucas/ .
Subscribe to:
Posts (Atom)