tag:blogger.com,1999:blog-19454259754864402532024-02-20T10:33:19.474-03:00Sapiens GarouLearn things on a extremely objective way. Computers, technologies, life, everything. Take a look, you will enjoy!Danilohttp://www.blogger.com/profile/02446928312297392433noreply@blogger.comBlogger18125tag:blogger.com,1999:blog-1945425975486440253.post-16298324771381004942012-11-16T10:42:00.000-02:002012-11-16T10:42:17.697-02:00How to rename a branch on git?<br />
1-Go to your repository<br />
<blockquote class="tr_bq">
cd /<Path to your git repository></blockquote>
2-Type:<br />
<blockquote class="tr_bq">
git branch -m <Old branch name> <New branch name></blockquote>
<h3>
Example</h3>
<blockquote class="tr_bq">
git branch -m blog garouBlog</blockquote>
Danilohttp://www.blogger.com/profile/02446928312297392433noreply@blogger.com0tag:blogger.com,1999:blog-1945425975486440253.post-22647397981115485422012-07-03T13:54:00.001-03:002012-07-03T13:56:27.591-03:00How discover your local IP address on Linux?1-Open terminal<br />
2-Type<br />
<blockquote class="tr_bq notranslate">
ifconfig <interface></blockquote>
<blockquote class="tr_bq">
where <i>interface</i> is your name of your network interface</blockquote>
3-Look for<br />
<blockquote class="tr_bq notranslate">
inet end.:</blockquote>
<h3>
Example</h3>
<blockquote class="tr_bq notranslate">
ifconfig eth0</blockquote>
<blockquote class="tr_bq notranslate">
ifconfig eth1</blockquote>
<blockquote class="tr_bq notranslate">
ifconfig wlan0 </blockquote>
<blockquote class="tr_bq notranslate">
<h4>
<span style="font-size: small;">Output </span></h4>
</blockquote>
<blockquote class="tr_bq">
<blockquote class="tr_bq notranslate">
eth1 Link encap:Ethernet Endereço de HW 78:e4:00:22:f8:86 <br />
<b>inet end.: 192.168.10.100</b> Bcast:192.168.10.255 Masc:255.255.255.0<br />
endereço inet6: fe80::7ae4:ff:fe22:f886/64 Escopo:Link<br />
UP BROADCAST RUNNING MULTICAST MTU:1500 Métrica:1<br />
pacotes RX:371047 erros:0 descartados:0 excesso:0 quadro:221100<br />
Pacotes TX:245369 erros:59 descartados:0 excesso:0 portadora:0<br />
colisões:0 txqueuelen:1000 <br />
RX bytes:475482323 (475.4 MB) TX bytes:57852121 (57.8 MB)<br />
IRQ:17 </blockquote>
</blockquote>
<blockquote class="tr_bq">
</blockquote>
<h3>
Arcam Sapientia</h3>
Some other usefull commands are, ifconfig, ifconfig -a to list all networks.<br />
<br />
If you don't know the name of your network interface just type <b>ifconfig</b> and search in each result what you are looking for.Danilohttp://www.blogger.com/profile/02446928312297392433noreply@blogger.com0tag:blogger.com,1999:blog-1945425975486440253.post-63583482348183063192012-06-21T17:15:00.000-03:002012-06-26T12:15:28.751-03:00How to prevent Google Translate translate a text on a web page?1-Add the text inside a element with the<br />
<blockquote class="tr_bq">
class <i>notranslate</i></blockquote>
<br />
<h3>
Example</h3>
This text will be translated.<span class="notranslate"> </span><br />
<span class="notranslate">But this text will be always in english.</span><br />
The text above have a span class surrounding it.<br />
<blockquote class="tr_bq">
<blockquote class="tr_bq">
< span class='notranslate'>Your text here.</span></blockquote>
</blockquote>
<h3>
Arcam Sapientia</h3>
You can use this to write blogs like these one and write some codes that should be always the same.<br />
<br />
PS.: soon this blog will implement this. <br />
<blockquote>
</blockquote>Danilohttp://www.blogger.com/profile/02446928312297392433noreply@blogger.com0tag:blogger.com,1999:blog-1945425975486440253.post-2615946261667859262012-06-20T19:55:00.000-03:002012-06-24T17:55:11.261-03:00How to fit the terminal/console results on the screen?<<span class='notranslate'>Your command> | less</span><br />
<h3>
<br />Example</h3>
<span class='notranslate'>ps ax | less</span><br />
<h3>
Arcam Sapientia</h3>
Using this tip we can prevent the output results of our command scroll down to the end. Or, we can fit the results to the screen and pressing <i>Enter</i> see rest of the resultsDanilohttp://www.blogger.com/profile/02446928312297392433noreply@blogger.com0tag:blogger.com,1999:blog-1945425975486440253.post-91624492181815703552012-06-20T19:47:00.000-03:002012-06-20T19:49:39.968-03:00How to use ASCII characters on KDE?1-Go to<br />
<blockquote class="tr_bq">
System settings->Input devices->Keyboard->Advanced->Position of the compose key</blockquote>
2-Choose a option available, like <i>Right Control</i><br />
3-Test it typing<br />
<blockquote class="tr_bq">
Righ_Control = c</blockquote>
4-You get<br />
<blockquote class="tr_bq">
€ </blockquote>
<h3>
Arcam Sapientia</h3>
This is the equivalent to the <i>Alt</i> on Windows systems.Danilohttp://www.blogger.com/profile/02446928312297392433noreply@blogger.com0tag:blogger.com,1999:blog-1945425975486440253.post-72440175044672071332012-06-20T19:31:00.002-03:002012-06-20T19:35:42.260-03:00How to change the keyboard layout for the console (Ctrl+Alt+F1)?1-Go to the console<br />
<blockquote class="tr_bq">
Press Control+Alt+F1, for example</blockquote>
2-Install the console-common package<br />
<blockquote class="tr_bq">
sudo apt-get install console-common</blockquote>
3-Follow the instructions and choose your new keyboard layout<br />
4-Test the new layout<br />
<h3>
Arcam Sapientia</h3>
To reconfigure your keybout layout run<br />
<blockquote class="tr_bq">
sudo dpkg-reconfigure console-common</blockquote>
This tip is useful to us keyboard for foreign users.Users that have pipeline (|) missing can emulate it using this tip too.<br />
<br />Danilohttp://www.blogger.com/profile/02446928312297392433noreply@blogger.com0tag:blogger.com,1999:blog-1945425975486440253.post-12812572602512362682012-06-19T19:01:00.002-03:002012-06-24T18:05:18.819-03:00How to run external programs/commands/functions in Sublime Text 2?1-Preferences->Key Bindings - User<br />
2- Override <i>[`,`]</i> to:<br />
<span class='notranslate'><blockquote class="tr_bq">
[</blockquote>
<blockquote class="tr_bq">
<blockquote class="tr_bq">
{ "keys": ["<Your shortucut>"], "command": "exec", "args": { "cmd"["<Path to your command>"]} }</blockquote>
</blockquote>
<blockquote class="tr_bq">
]</blockquote></span>
<br />
<br />
Where <i><Your shortcut></i> could be <b>f1</b>, <b>ctrl+shift+f1</b>, etc. and <i><Path to your command></i> <i>echo</i>, <i>/home/garou/scripts/my_script.py</i>, <i>ls</i>, etc.<br />
<br />
<h3>
<b>Example</b></h3>
<br />
<span class='notranslate'>[<br />
{ "keys": ["f1"], "command": "exec", "args": { "cmd": ["/media/data/Scripts/myScript"]} },<br />
]</span><br />
<br />
<h3>
Arcam Sapientia</h3>
This virtually could run any system command.Danilohttp://www.blogger.com/profile/02446928312297392433noreply@blogger.com5tag:blogger.com,1999:blog-1945425975486440253.post-61041046073028500762012-06-18T18:01:00.001-03:002012-06-24T18:00:39.705-03:00Check KDE version by terminal<span class='notranslate'>kded4 --version</span><br />
<br />
<h3>
Arcam Sapientia</h3>
If not works, try:<br />
<blockquote class="tr_bq">
<span class='notranslate'>kded --version</span></blockquote>Danilohttp://www.blogger.com/profile/02446928312297392433noreply@blogger.com0tag:blogger.com,1999:blog-1945425975486440253.post-3501133651377255552012-06-17T12:36:00.000-03:002012-06-24T17:58:56.818-03:00How to check GMail by terminal?1 Type:<br />
<blockquote class="tr_bq">
<span class='notranslate'>curl -u <Your gmail username> --silent "https://mail.google.com/mail/feed/atom" | perl -ne 'print "\t" if //; print "$2\n" if /<(title|name)>(.*)<\/\1>/;'</span></blockquote>
2 Enter the password<br />
3 See your unread messagesDanilohttp://www.blogger.com/profile/02446928312297392433noreply@blogger.com0tag:blogger.com,1999:blog-1945425975486440253.post-34890449371438521392012-06-14T11:19:00.000-03:002012-06-14T11:19:34.028-03:00How to create a symbolic link (symlink)?ln -s <Path to the file> <Path to the target><br />
<h4>
Example</h4>
ln -s /media/data/script.sh /home/garou/scripts/<br />
<h4>
<br />Arcam Sapientia</h4>
We can use <i>sudo </i>in the beginning of the command if we don't have write privilege in the target.<br />
<br />
We can specify a new name to link too, like:<br />
<blockquote class="tr_bq">
sudo ln -s /media/data/script.sh /usr/bin/macro.sh</blockquote>Danilohttp://www.blogger.com/profile/02446928312297392433noreply@blogger.com0tag:blogger.com,1999:blog-1945425975486440253.post-82809612117801752012012-06-11T09:07:00.002-03:002012-06-11T09:08:02.402-03:00How to prompt for a password when running a command or script?kdesudo "<Full command>"<br />
<h3>
Example</h3>
1 - Open the run command with Alt+F2<br />
2 - To reboot (needs root), for example, type:<br />
<blockquote class="tr_bq">
kdesudo "shutdown -r now"</blockquote>
3- Type your root password and hit Return<br />
4 - Your system will reboot after this<br />
<h3>
Arcam Sapientia</h3>
You can use this on scripts to prompt for a pass when it is needed.<br />
<br />
<blockquote class="tr_bq">
#!/bin/sh</blockquote>
<blockquote class="tr_bq">
clementine </blockquote>
<blockquote class="tr_bq">
kdesudo "shutdown -r 00:00" </blockquote>
<br />
This will open the clementine music player and reboot at 00:00 time.Danilohttp://www.blogger.com/profile/02446928312297392433noreply@blogger.com0tag:blogger.com,1999:blog-1945425975486440253.post-39982971798052193342012-06-10T16:10:00.001-03:002012-06-10T16:27:17.690-03:00How to put something on clipboard?1 Install xclip<br />
<blockquote class="tr_bq">
sudo apt-get install xclip </blockquote>
2 Type:<br />
<blockquote class="tr_bq">
echo "<Your text here>" | xclip</blockquote>
<h3>
Example </h3>
<blockquote class="tr_bq">
echo "<i>Sapiens Garou</i> is a good blog." | xclip</blockquote>
<br />
Test on a text editor pressing <i>Control+v</i> to see working <br />
<h3>
Arcam Sapientia</h3>
See the manual to other usefull options:<br />
<blockquote class="tr_bq">
man xclip </blockquote>
P.S.: Learn how to put a text on the clipboard by using a command line (terminal) on Linux/Unix.Danilohttp://www.blogger.com/profile/02446928312297392433noreply@blogger.com0tag:blogger.com,1999:blog-1945425975486440253.post-14259334348012570062012-06-10T16:03:00.001-03:002012-06-10T16:04:15.323-03:00How to change the brightness (backlight) on Linux by terminal?<blockquote class="tr_bq">
xbacklight -set <value></blockquote>
<h3>
Example</h3>
<blockquote class="tr_bq">
xbacklight -set 20.0</blockquote>
<h3>
Arcam Sapientia</h3>
See the man for more options<br />
<blockquote class="tr_bq">
man xbacklight</blockquote>Danilohttp://www.blogger.com/profile/02446928312297392433noreply@blogger.com0tag:blogger.com,1999:blog-1945425975486440253.post-68409944936322478952012-06-10T15:56:00.003-03:002012-06-10T16:01:50.917-03:00How to change the constrast by terminal on Linux?<blockquote class="tr_bq">
xgamma -gamma <value></blockquote>
<h3>
Example</h3>
<blockquote class="tr_bq">
xgamma -gamma 0.6</blockquote>
<h3>
Arcam Sapientia </h3>
Gamma values must be between 0.100 and 10.000<br />
See the man too<br />
<blockquote class="tr_bq">
$man xgamma </blockquote>Danilohttp://www.blogger.com/profile/02446928312297392433noreply@blogger.com0tag:blogger.com,1999:blog-1945425975486440253.post-77817929869542193452012-06-10T03:26:00.000-03:002012-06-10T15:59:58.995-03:00How to change the system volume by terminal on Linux?amixer set Master <volume><br />
<h3>
Example</h3>
amixer set Master 20<br />
<h3>
Arcam Sapientia</h3>
See the manual to another helpfull parameters<br />
<blockquote class="tr_bq">
$man amixer</blockquote>Danilohttp://www.blogger.com/profile/02446928312297392433noreply@blogger.com0tag:blogger.com,1999:blog-1945425975486440253.post-69980168192768312232012-06-10T02:38:00.000-03:002012-06-10T02:38:36.434-03:00How to use floating numbers in Shell Script?<variable> =`echo "scale=<precision>;<operations>"`<br />
<br />
<h3>
Example:</h3>
Write a code file named <b>float</b> as follow:<br />
<br />
#!/bin/sh<br />
floatNumber=`echo "scale=2;1/2" | bc`<br />
echo $floatNumber <br />
<br />
When you run it, the result will be:<br />
$./float<br />
.50Danilohttp://www.blogger.com/profile/02446928312297392433noreply@blogger.com0tag:blogger.com,1999:blog-1945425975486440253.post-10614879848925231082012-06-07T12:37:00.001-03:002012-06-07T12:39:40.226-03:00How to run Mathematica functions on Python?1-Create a script named <b>runMath</b> with the content:<br />
<br />
<span style="font-family: "Courier New",Courier,monospace;">#!/usr/local/bin/MathematicaScript -script</span><br />
<br />
<span style="font-family: "Courier New",Courier,monospace;"> value=ToExpression[$ScriptCommandLine[[2]]];</span><br />
<br />
<span style="font-family: "Courier New",Courier,monospace;"> (*The next line prints the script name.*)</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> (*Print[$ScriptCommandLine[[1]]];*)</span><br />
<br />
<span style="font-family: "Courier New",Courier,monospace;"> Print[value];</span><br />
<br />
2-Give execution privilege to the file:<br />
<span style="font-family: "Courier New",Courier,monospace;"> sudo chmod +x runMath</span><br />
<br />
3-Move the file to the execution path:<br />
<br />
<span style="font-family: "Courier New",Courier,monospace;"> sudo mv runMath /usr/bin/</span><br />
<br />
4-Create a new script called <b>run</b> with the content:<br />
<br />
<span style="font-family: "Courier New",Courier,monospace;">#!/usr/bin/python</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> from subprocess import *</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> from sys import *</span><br />
<br />
<span style="font-family: "Courier New",Courier,monospace;"> command='/usr/bin/runMath'</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> parameter=argv[1]</span><br />
<br />
<span style="font-family: "Courier New",Courier,monospace;"> call([command,parameter])</span><br />
<br />
5-Move to the execution path:<br />
<br />
<span style="font-family: "Courier New",Courier,monospace;"> sudo mv run /usr/bin</span><br />
<br />
6-Finally, test it:<br />
<br />
<span style="font-family: "Courier New",Courier,monospace;"> $run Prime[100]</span><br />
<div style="font-family: "Courier New",Courier,monospace;">
541</div>
<br />
<span style="font-family: "Courier New",Courier,monospace;"> $run 'Sum[2x-1,{x,1,k}]'</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> k^2</span><br />
<br />
<span style="font-family: "Courier New",Courier,monospace;"> $run Integrate[Log[x],x]</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> -x + x*Log[x]</span><br />
<br />
<span style="font-family: "Courier New",Courier,monospace;"> $run 'Zeta[2]'</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> Pi^2/6</span><br />
<br />
You can use with ou without <b style="color: yellow;">'</b>. The <b style="color: yellow;">'</b> are needed to commands with spaces.<br />
<br />
<span style="font-family: "Courier New",Courier,monospace;"> $run 'f[n_] := f[n] = f[n - 1] + f[n - 2]; f[1] = f[2] = 1; Table[f[n],{n,5}]'</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> {1, 1, 2, 3, 5}</span>Danilohttp://www.blogger.com/profile/02446928312297392433noreply@blogger.com23tag:blogger.com,1999:blog-1945425975486440253.post-32788368975725671982012-06-07T11:41:00.000-03:002012-06-07T11:41:01.393-03:00Localization of the Hosts file on Windows systems. XP, Vista, 7, NT, 2000, Me, 98, 95.<h3>
Windows XP Home/Vista/7</h3>
<blockquote class="tr_bq">
c:\windows\system32\drivers\etc\hosts </blockquote>
<blockquote class="tr_bq">
<blockquote class="tr_bq">
or <br />
<br /></blockquote>
</blockquote>
<blockquote class="tr_bq">
%systemroot%\system32\drivers\etc\hosts </blockquote>
<h3>
Windows NT/2000/XP Pro</h3>
<blockquote class="tr_bq">
c:\ winnt\system32\drivers\etc\hosts</blockquote>
<blockquote class="tr_bq">
<blockquote class="tr_bq">
or <br />
<br /></blockquote>
</blockquote>
<blockquote class="tr_bq">
%systemroot%\system32\drivers\etc\hosts </blockquote>
<h3>
Windows 95/98/Me </h3>
<blockquote class="tr_bq">
c:\windows\hosts</blockquote>
<blockquote class="tr_bq">
<blockquote class="tr_bq">
or </blockquote>
</blockquote>
<blockquote class="tr_bq">
%systemroot%\hosts</blockquote>Danilohttp://www.blogger.com/profile/02446928312297392433noreply@blogger.com0