This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| So given a number count the number of 1's it has set in it's binary representation. Easy! | |
| Just keep on dividing by two (or bitshift right) and see if the number is odd or even and increment the count based | |
| on this criteria like so: | |
| getNumBitsSet(int val) { | |
| int count=0; | |
| while(val>0) { | |
| if(val % 2 != 0) | |
| count++; | |
| count = count / 2; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sudo update-alternatives –config editor |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| I already had git ssh keys set up and now wanted to use the same one for logging into my Digital Ocean droplet. To copy over ssh keys to the remote droplet just do: | |
| ssh-copy-id user@address |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| To get rid of them run: | |
| gconftool-2 -s -t string '/apps/compiz-1/plugins/decor/screen0/options/decoration_match' '!(state=maxvert & state=maxhorz)' | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| So there are times when you need to connect to a remote server and do some sort of work on the files. | |
| One alternative is to use an FTP client such as FileZilla and constantly upload to view changes. | |
| Scratch that, just use SSHFS! It mounts the remote drive/directory on your local machine and you can | |
| work/save files and the changes will be automatically uploaded. | |
| First install sshfs, on Ubuntu: sudo apt-get install sshfs | |
| In order to mount a drive use your usual ssh account and specify a directory on which you would like the mount | |
| to occur like so: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| First we need to install MySQL with the following: | |
| sudo apt-get install mysql-server | |
| Note: You will be prompted for the root password in the middle of the installation. | |
| Now this is optional (for uses with MySQL workbench): | |
| sudo apt-get install mysql-client | |
| Now to test it out try: mysql -uroot -p |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| The only simple command you need is: | |
| sudo apt-get install apache2 | |
| Navigate to: http://localhost and you shall see the magical 'It works!' file! | |
| Now to get PHP working: | |
| sudo apt-get install php5 | |
| sudo apt-get install libapache2-mod-php5 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Fire up the terminal and run this command: | |
| dpkg -l | awk '/linux-[^ ]+-[0-9]/ {print $2}' | |
| It should print all of the available kernel versions. | |
| Check which version of kernel you are currently running by typing in: uname -a | |
| Once you know which new version of the kernel you want to remove type: | |
| sudo apt-get purge linux-headers-3.8...... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| This is the setting placed in ~/.mozilla/firefox/<default-user-profile>/chrome/userChrome.css: | |
| /******* | |
| START | |
| ********/ | |
| /*Do not remove the @namespace line -- it's required for correct functioning*/ | |
| @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); | |
| /*Toolbar & menu font size*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Recently my dorm wireless network has been working fine on all devices except my Ubuntu 12.10 laptop. | |
| So I did some research and some simple fixes that have seemed to work for now are: | |
| -change router security to WPA2 only | |
| -change router channel from automatic to either 1 or 11 | |
| -if router is b/g/n, attempt to change to b/g (was not able to do this with my router) | |
| -sudo vim /etc/modprobe.d/rtl8192ce.conf and insert the following line: | |
| 'options rtl8192ce ips=0 fwlps=0 swenc=1 debug=2' | |
| Switched to Ubuntu 12.04 and entered the following to see if wireless works better: |