sabato, dicembre 12, 2015
sabato, novembre 14, 2015
martedì, ottobre 13, 2015
PassportJS - NodeJS login with Facebook
http://passportjs.org/
https://github.com/jaredhanson/passport-facebook/tree/master/examples/login
Create an appId and App secrete from https://developers.facebook.com/
In local development make sure you follow this http://stackoverflow.com/a/26457495/379173
I added localhost:3000 since my node js process was running on port 3000.
https://github.com/jaredhanson/passport-facebook/tree/master/examples/login
Create an appId and App secrete from https://developers.facebook.com/
In local development make sure you follow this http://stackoverflow.com/a/26457495/379173
I added localhost:3000 since my node js process was running on port 3000.
Installing postgresql on Ubuntu [Notes]
$ sudo apt-get update
$ sudo apt-get install postgresql postgresql-contrib
Ubuntu Software center: pgAdmin III
$ sudo -u postgres -s
$ psql
postgres=# ALTER USER postgres PASSWORD 'xxx';
https://www.digitalocean.com/community/tutorials/how-to-install-and-use-postgresql-on-ubuntu-14-04
http://www.linuxscrew.com/2009/07/03/postgresql-show-tables-show-databases-show-columns/
exit from psql
$ sudo apt-get install postgresql postgresql-contrib
Ubuntu Software center: pgAdmin III
$ sudo -u postgres -s
$ psql
postgres=# ALTER USER postgres PASSWORD 'xxx';
https://www.digitalocean.com/community/tutorials/how-to-install-and-use-postgresql-on-ubuntu-14-04
http://www.linuxscrew.com/2009/07/03/postgresql-show-tables-show-databases-show-columns/
exit from psql
venerdì, settembre 25, 2015
MongoDB session
enrico@enrico-XPS13:~/mongodb$ mongo
MongoDB shell version: 3.0.6
connecting to: test
> show dbs
enrico 0.078GB
local 0.078GB
nodetest1 0.078GB
test 0.078GB
> use enrico
switched to db enrico
> for (var i=0;i<10 i="" p="" print="">0
1
2
3
4
5
6
7
8
9
> use blog
switched to db blog
> db
blog
> db.posts.insert({
... title: "My first post",
... authorName: "Alvise",
... authorEmail: "enricogiurin@gmail.com",
... pubDate: new Date
...
... });
WriteResult({ "nInserted" : 1 })
> db.posts.count()
1
> db.posts.findOne()
{
"_id" : ObjectId("5604925564958e61b7a10dda"),
"title" : "My first post",
"authorName" : "Alvise",
"authorEmail" : "enricogiurin@gmail.com",
"pubDate" : ISODate("2015-09-25T00:16:21.649Z")
}
> db.posts.insert({title: "another post", "_id": 123});
WriteResult({ "nInserted" : 1 })
> db.posts.count()
2
> db.posts.find()
{ "_id" : ObjectId("5604925564958e61b7a10dda"), "title" : "My first post", "authorName" : "Alvise", "authorEmail" : "enricogiurin@gmail.com", "pubDate" : ISODate("2015-09-25T00:16:21.649Z") }
{ "_id" : 123, "title" : "another post" }
> db.posts.find().pretty()
{
"_id" : ObjectId("5604925564958e61b7a10dda"),
"title" : "My first post",
"authorName" : "Alvise",
"authorEmail" : "enricogiurin@gmail.com",
"pubDate" : ISODate("2015-09-25T00:16:21.649Z")
}
{ "_id" : 123, "title" : "another post" }
> db.posts.insert({
... title: "My first post",
... author: {
... firstName: "Enrico",
... lastName: "Giurin",
... email: "enricogiurin@gmail.com"
... },
... tags: ["coding", "mongodb", "db"],
... pubDate: new Date
...
... });
WriteResult({ "nInserted" : 1 })
> db.posts.find().pretty()
{
"_id" : ObjectId("5604925564958e61b7a10dda"),
"title" : "My first post",
"authorName" : "Alvise",
"authorEmail" : "enricogiurin@gmail.com",
"pubDate" : ISODate("2015-09-25T00:16:21.649Z")
}
{ "_id" : 123, "title" : "another post" }
{
"_id" : ObjectId("5604946d64958e61b7a10ddb"),
"title" : "My first post",
"author" : {
"firstName" : "Enrico",
"lastName" : "Giurin",
"email" : "enricogiurin@gmail.com"
},
"tags" : [
"coding",
"mongodb",
"db"
],
"pubDate" : ISODate("2015-09-25T00:25:17.293Z")
}
> db.posts.find({title: "My fist post"});
> db.posts.find({title: "My first post"});
{ "_id" : ObjectId("5604925564958e61b7a10dda"), "title" : "My first post", "authorName" : "Alvise", "authorEmail" : "enricogiurin@gmail.com", "pubDate" : ISODate("2015-09-25T00:16:21.649Z") }
{ "_id" : ObjectId("5604946d64958e61b7a10ddb"), "title" : "My first post", "author" : { "firstName" : "Enrico", "lastName" : "Giurin", "email" : "enricogiurin@gmail.com" }, "tags" : [ "coding", "mongodb", "db" ], "pubDate" : ISODate("2015-09-25T00:25:17.293Z") }
> db.posts.find({title: "My first post"}).count()
2
> db.posts.find({title: /po/i}).count()
3
> db.posts.find({title: /pos/i}).count()
3
> db.posts.find({title: /first/i}).count()
2
> db.posts.find({title: /first/i},{title:1})
{ "_id" : ObjectId("5604925564958e61b7a10dda"), "title" : "My first post" }
{ "_id" : ObjectId("5604946d64958e61b7a10ddb"), "title" : "My first post" }
> db.posts.find({title: /first/i},{title:1, _id: 0})
{ "title" : "My first post" }
{ "title" : "My first post" }
> db.posts.find({title: /first/i},{title:1, _id: 0}).pretty()
{ "title" : "My first post" }
{ "title" : "My first post" }
> db.posts.find({"author.email": "enricogiurin@gmail.com"}).pretty()
{
"_id" : ObjectId("5604946d64958e61b7a10ddb"),
"title" : "My first post",
"author" : {
"firstName" : "Enrico",
"lastName" : "Giurin",
"email" : "enricogiurin@gmail.com"
},
"tags" : [
"coding",
"mongodb",
"db"
],
"pubDate" : ISODate("2015-09-25T00:25:17.293Z")
}
> db.posts.find({"author.email": "enricogiurin@gmail.co"}).pretty()
> db.posts.find({"author.email": /urin@gmail.co/}).pretty()
{
"_id" : ObjectId("5604946d64958e61b7a10ddb"),
"title" : "My first post",
"author" : {
"firstName" : "Enrico",
"lastName" : "Giurin",
"email" : "enricogiurin@gmail.com"
},
"tags" : [
"coding",
"mongodb",
"db"
],
"pubDate" : ISODate("2015-09-25T00:25:17.293Z")
}
10>
sabato, giugno 20, 2015
giovedì, giugno 18, 2015
Avoiding CORS issues with chromium
Install 'Chromium Web Browser' in ubuntu through Ubuntu Software Center.
From any location type:
$ chromium-browser --disable-web-security &
This avoid limitations of browsers with CORS.
From any location type:
$ chromium-browser --disable-web-security &
This avoid limitations of browsers with CORS.
venerdì, giugno 05, 2015
venerdì, maggio 29, 2015
"Venture" Meet Suport Organizations Zurich - May 28th 2015
Here some notes, in random order, taken from the event which took place yesterday at the ETH in Zurich, subject: support for startups in Switzerland.
- Formation, TechnoPark (4 modules)
- Entrepreneur club
- ETH spin off
- CTI start-up
- http://www.startzentrum.ch/
- Blue Lion incubator
- start-up battle
- start-up support http://www.ifj.ch/index.cfm
- http://www.venturelab.ch/index.cfm
- http://www.venturekick.ch/
- Supporting Social Business - http://seif.org/de_DE/
- http://www.startupticker.ch/en/home
- CTI invest - deals events training
- http://www.ceoday.ch/
- Pitch competition
- http://www.angelday.ch/
- Lean methodology
- Providing network for startups - http://www.i-net.ch/en/ (Basel)
- ICT - Information and communications technology
mercoledì, maggio 20, 2015
Ansible resources
http://networklore.com/ansible/
http://networklore.com/ansible-getting-started/
http://en.wikipedia.org/wiki/Ansible_(software)
Similar tools: puppet, chef, salt
http://networklore.com/ansible-getting-started/
http://en.wikipedia.org/wiki/Ansible_(software)
Similar tools: puppet, chef, salt
sabato, maggio 16, 2015
giovedì, aprile 23, 2015
Linux/Unix useful commands
- ls | wc -l (number of files in a folder)
- $ find . -iname 'Courses.json' -> find in the current folder and subfolders the file 'Courses.json'
- $ grep MemTotal /proc/meminfo
- $find . -type f -name '*.DS_Store*' -delete
mercoledì, aprile 01, 2015
git useful commands
################ git commands ################
$ git config --global user.name "Enrico Giurin"
$ git init --> creates local repo /users/enrico/store/.git
$ git add xxx
$ git commit -m ".." .
$ git status
$ git add --all .
branch: master
$ git add --all
creates snapshot
$ git log
##############################
$ git diff
$ git reset
$ git reset --hard - undo local changes since that revision
$ git checkout -- (blow way all changes since last commit)
$ git commit -a -m "xxx" add & commit
$ git reset --soft HEAD undo last commit
$ git commit --amend -m "..." changed the last commit
$ git reset --hard HEAD^ undo last commit and all changes
$ git reset --hard HEAD^^ undo last 2 commits and all changes
$ git push
$ git pull
- origin: name of the remote repository
$ git remote add origin https.//github.com/egch/xxx
$ git remote -v
$ git push -u origin master (origin: remote / master: local)
##############################
$ git clone
$ git clone yourName
$ git remote -v
$ git branch (cat)
$ git checkout cat
$ git checkout master
$ git merge cat
$ git branch -d cat (removing branch cat)
$ git checkout -b admin (switch and create a new branch)
--> go back to master
$ git checkout master
(fix something in the master and now we merge the admin)
$ git merge admin
vi editor
git log ( a message log related to the merge)
##############################
$ git pull (fetch)
$ git push
$ git commit -a -m "merged"(after merge)
<<<<< my version
>>>>> their version
##############################
$ git checkout -b shopping_cart
$ git push origin shopping_cart
$ git push
[jane] $ git pull
$ git branch
$ git branch -r (remote branches)
$ git checkout shopping_cart
$ git remote show origin
$ git push origin :shopping_cart (to delete the remote branch)
$ git branch -d shopping_cart (trying to delete local branch)
$ git branch -D shopping_cart (force to delete local branch)
$ git remote prune origin (to cleanup delete remote branches)
$ git tag (list all tags)
$ git checkout v0.0.1 (checkout code at commit)
$ git tag -a v0.0.3 -m "version" (to create a new tag)
$ git push --tags (to push the tags)
########################################
$ git log
$ git config --global color.ui true
$ git log --pretty=oneline
$ gitl log --pretty=format: "%h %ad- %s [%an]"
(ad=author date, an=author name,h=SSH hash, s=subject,d=ref names)
$ git log --online -p
$ git log --online --stat
$ git log --online --graph
$ git log --since=2000-02-02 --until=2003-10-10
$ git diff
$ git diff HEAD~5 (5 commits ago)
$ git diff master bird
$ git diff --since=1.month.ago --until=2.minutes.ago
$ git blame list.html --date short
.git/info/exlude : to esclude some files from commit
pattern: logs/*.log
.gitignore (logs/*.log)
$ git rm README.txt
$ git rm --cached mylog.log
$ git config --global core.editor notepad++
ALIASES
$ git config --global alias.mylog "log --pretty=format:'%h %s [%an]' --graph"
$ git myLog
$ git config --global user.name "Enrico Giurin"
$ git init --> creates local repo /users/enrico/store/.git
$ git add xxx
$ git commit -m ".." .
$ git status
$ git add --all .
branch: master
$ git add --all
creates snapshot
$ git log
##############################
$ git diff
$ git reset
$ git commit -a -m "xxx" add & commit
$ git reset --soft HEAD undo last commit
$ git commit --amend -m "..." changed the last commit
$ git reset --hard HEAD^ undo last commit and all changes
$ git reset --hard HEAD^^ undo last 2 commits and all changes
$ git push
$ git pull
- origin: name of the remote repository
$ git remote add origin https.//github.com/egch/xxx
$ git remote -v
$ git push -u origin master (origin: remote / master: local)
##############################
$ git clone
$ git clone
$ git remote -v
$ git branch
$ git checkout cat
$ git checkout master
$ git merge cat
$ git branch -d cat (removing branch cat)
$ git checkout -b admin (switch and create a new branch)
--> go back to master
$ git checkout master
(fix something in the master and now we merge the admin)
$ git merge admin
vi editor
git log ( a message log related to the merge)
##############################
$ git pull (fetch)
$ git push
$ git commit -a -m "merged"(after merge)
<<<<< my version
>>>>> their version
##############################
$ git checkout -b shopping_cart
$ git push origin shopping_cart
$ git push
[jane] $ git pull
$ git branch
$ git branch -r (remote branches)
$ git checkout shopping_cart
$ git remote show origin
$ git push origin :shopping_cart (to delete the remote branch)
$ git branch -d shopping_cart (trying to delete local branch)
$ git branch -D shopping_cart (force to delete local branch)
$ git remote prune origin (to cleanup delete remote branches)
$ git tag (list all tags)
$ git checkout v0.0.1 (checkout code at commit)
$ git tag -a v0.0.3 -m "version" (to create a new tag)
$ git push --tags (to push the tags)
########################################
$ git log
$ git config --global color.ui true
$ git log --pretty=oneline
$ gitl log --pretty=format: "%h %ad- %s [%an]"
(ad=author date, an=author name,h=SSH hash, s=subject,d=ref names)
$ git log --online -p
$ git log --online --stat
$ git log --online --graph
$ git log --since=2000-02-02 --until=2003-10-10
$ git diff
$ git diff HEAD~5 (5 commits ago)
$ git diff master bird
$ git diff --since=1.month.ago --until=2.minutes.ago
$ git blame list.html --date short
.git/info/exlude : to esclude some files from commit
pattern: logs/*.log
.gitignore (logs/*.log)
$ git rm README.txt
$ git rm --cached mylog.log
$ git config --global core.editor notepad++
ALIASES
$ git config --global alias.mylog "log --pretty=format:'%h %s [%an]' --graph"
$ git myLog
giovedì, marzo 26, 2015
Windows 32-64 bit
http://windows.microsoft.com/en-us/windows7/find-out-32-or-64-bit
Vista: Click the Start button , right-click Computer, and then click Properties.
Vista: Click the Start button , right-click Computer, and then click Properties.
mercoledì, marzo 25, 2015
Node.js Resources
- how-to-set-up-a-node-js-application-for-production-on-ubuntu-14-04
- http://runnable.com/U0MpcpIzdaRkX2VH/querying-mongodb-from-express-using-mongoose-for-node-js
- http://abdelraoof.com/blog/2014/11/11/install-nodejs-without-admin-rights/ (how to install NodeJS in Windows with no admin grants)
- https://rtcamp.com/tutorials/nodejs/node-js-npm-install-ubuntu/ - how to install the latest version of nodejs and npm on ubuntu 12.04
- https://davidwalsh.name/upgrade-nodejs - how to upgrade your version of node to the latest
martedì, febbraio 17, 2015
Remote work resources
- weworkremotely.com
- jobs.github.com
- jobs.remotive.io
- careers.stackoverflow.com
- nomadjobs.io
- hnhiring.me
- jobmote.com
Thanks to Luca Guidi (JUG Milano)
domenica, febbraio 15, 2015
lunedì, gennaio 19, 2015
Iscriviti a:
Post (Atom)