This file contains 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
// implementation 1 | |
object Users { | |
var users: Seq[User] = Seq() | |
def delete(id: Long) : Option[Int] = { | |
val originalSize = users.length | |
this.users = users.filterNot(_.id == id) | |
Some(originalSize - users.length) | |
} | |
} |
This file contains 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
typedef struct WorkerParams { | |
int thread_id; | |
Log * log; | |
Jobs * jobs; | |
pthread_mutex_t jobs_lock; | |
pthread_cond_t work_added; | |
} WorkerParams; | |
void main() { | |
launch_master_node(3); |
This file contains 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
# deb cdrom:[Ubuntu-Server 14.10 _Utopic Unicorn_ - Rlease amd64 / utopic main restricted | |
#deb cdrom:[Ubuntu-Server 14.10 _Utopic Unicorn_ - Release amd64 / utopic main restricted | |
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to | |
# newer versions of the distribution. | |
deb http://mirrors.digitalocean.com/ubuntu-old/ utopic main restricted | |
deb-src http://mirrors.digitalocean.com/ubuntu-old/ utopic main restricted | |
## Major bug fix updates produced after the final release of the |
This file contains 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
Ign http://downloads-distro.mongodb.org dist InRelease | |
Hit http://downloads-distro.mongodb.org dist Release.gpg | |
Hit http://downloads-distro.mongodb.org dist Release | |
Hit http://downloads-distro.mongodb.org dist/10gen amd64 Packages | |
Ign http://old-releases.ubuntu.com utopic-security InRelease | |
Hit http://downloads-distro.mongodb.org dist/10gen i386 Packages | |
Hit http://old-releases.ubuntu.com utopic-security Release.gpg | |
Ign http://downloads-distro.mongodb.org dist/10gen Translation-en_US | |
Ign http://downloads-distro.mongodb. |
This file contains 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
edit Homestead.yaml and add under sites section | |
-map: domain.app | |
to: /path/to/public | |
on own machine (NOT VM) edit /etc/hosts and add another entry, grab IP from Homestead.yaml and add line: | |
<ip-from-yaml> domain.app | |
vagrant reload --provision | |
DONE! |
This file contains 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
# Place: "fprintf('[%i, %i],',round((maxr+minr)/2), round((maxc + minc)/2));" in Matlab for image test1.bmp or test2.bmp | |
# put the output into test1/test2 var as below | |
# script prints out centers of figures on image in order (left to right then top to bottom) | |
def gen_data(a,mod): | |
a_by_rows = [] | |
temp_row = [] | |
i=1 | |
for x,y in a: | |
temp_row.append([y,x]) |
This file contains 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
objdump -d -M intel -S test.o |
This file contains 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
grep -c -r 'import' Python-2.5.4/ | \ | |
awk -F : '{total += $2; print $1, $2} END { print "Total:", total }' | |
Source: http://stackoverflow.com/questions/884591/grep-recursive-and-count |
This file contains 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
If you get tired of typing public class... and then the main method in vim | |
then here is your solution. | |
autocmd BufNewFile *.java | |
\ exe "normal Opublic class " . expand('%:t:r') . " {\npublic static void main(String [] args) {\n\n}\n}\<Esc>1G" | |
Just insert it into your '.vimrc' and that's it! The next time you open a brand new Java file you | |
will see a template. |
This file contains 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
1. mongo | |
2. use <your-database-name-here> | |
3. db.addUser('pawel','test') | |
4. exit | |
5. vim /etc/mongodb.conf uncomment the line '#auth=true' | |
6. sudo service mongodb stop | |
7. sudo service mongodb start | |
7.5 Run your application as it is now and verify that it fails since it is missing authentication. | |
8. in your python code add: db.authenticate('pawel','test') | |
9. sudo service apache2 restart |
NewerOlder