Skip to content

Instantly share code, notes, and snippets.

View jobsamuel's full-sized avatar
🔥
creating

Jobsamuel Núñez jobsamuel

🔥
creating
View GitHub Profile
@jobsamuel
jobsamuel / mongodb_practice.js
Last active August 29, 2015 14:05
MongoDB connection close error
var MongoClient = require('mongodb').MongoClient;
MongoClient.connect('mongodb://localhost:27017/course', function(err, db) {
if(err) throw err;
for (var i = 0; i<10; i++) {
var fields = ["Engineering", "Medicine", "Marketing"];
var langs = ["EN", "POR", "ES"];
Set-ExecutionPolicy RemoteSigned
$mongoDbPath = "C:\MongoDB"
$mongoDbConfigPath = "$mongoDbPath\mongod.cfg"
$url = "https://fastdl.mongodb.org/win32/mongodb-win32-x86_64-2008plus-2.6.4.zip"
$zipFile = "$mongoDbPath\mongo.zip"
$unzippedFolderContent ="$mongoDbPath\mongodb-win32-x86_64-2008plus-2.6.4"
if ((Test-Path -path $mongoDbPath) -eq $True)
{
@jobsamuel
jobsamuel / readme.md
Last active January 19, 2024 18:26
Run NodeJS as a Service on Ubuntu 14.04 LTS

Run NodeJS as a Service on Ubuntu 14.04 LTS

With Node you can write very fast JavaScript programs serverside. It's pretty easy to install Node, code your program, and run it. But > how do you make it run nicely in the background like a true server?

  • Go to /etc/init/
  • $ sudo vim yourapp.conf
  • Paste script.conf
  • $ sudo start yourapp
  • And when you wanna kill the process $ sudo stop yourapp
@jobsamuel
jobsamuel / students.js
Created September 5, 2014 21:31
Playing with MongoDB - Inserting documents
//////////////////////////////
// Playing with MongoDB /////
// 1 - Inserting documents /
///////////////////////////
// MongoDB Driver module.
var MongoClient = require('mongodb').MongoClient
// Set the name of the database you want to connect with.
@jobsamuel
jobsamuel / find.js
Last active August 29, 2015 14:06
Playing with MongoDB - Finding documents
/////////////////////////////
// Playing with MongoDB ////
// 2 - Finding documents //
//////////////////////////
// MongoDB Driver instances.
var MongoClient = require('mongodb').MongoClient
, ObjectId = require('mongodb').ObjectID
@jobsamuel
jobsamuel / s3Bucket.js
Created September 9, 2014 03:34
Uploading and Image to an existing AWS S3 Bucket
// File System node module.
var fs = require('fs');
// Amazon SDK node module.
var AWS = require('aws-sdk');
// Read a file in the project folder that contains your AWS credentials.
// On a production server, you would want to reference the credentials using environmental variables.
@jobsamuel
jobsamuel / update.js
Last active August 29, 2015 14:06
Playing with MongoDB - Updating documents
/////////////////////////////
/// Playing with MongoDB ///
// 3 - Updating documents /
//////////////////////////
// MongoDB Driver instance.
var MongoClient = require('mongodb').MongoClient
// Set the database and collection name you want to connect to perform the update.

Getting Started with NPM (as a developer)

If you haven't already set your NPM author info, now you should:

npm set init.author.name "Your Name"
npm set init.author.email "you@example.com"
npm set init.author.url "http://yourblog.com"

npm adduser

@jobsamuel
jobsamuel / install.sh
Last active April 21, 2020 06:53
Install MongoDB 3.0 in Ubuntu 14.04 LTS
#!/bin/bash
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list
sudo apt-get update
sudo apt-get install -y mongodb-org=3.0.0 mongodb-org-server=3.0.0 mongodb-org-shell=3.0.0 mongodb-org-mongos=3.0.0 mongodb-org-tools=3.0.0
sudo service mongod start
@jobsamuel
jobsamuel / st3.json
Last active March 7, 2017 13:40
Configuration File - Material Theme for Sublime Text 3
{
"always_show_minimap_viewport": true,
"bold_folder_labels": true,
"color_scheme": "Packages/ayu/ayu-dark.tmTheme",
"font_options":
[
"gray_antialias"
],
"font_size": 11,
"ignored_packages":