Skip to content

Instantly share code, notes, and snippets.

View hugobarzano's full-sized avatar
💭
2 hard 2 break; 2 hard 2 hold;

César Hugo Bárzano Cruz hugobarzano

💭
2 hard 2 break; 2 hard 2 hold;
View GitHub Profile
@hugobarzano
hugobarzano / sshKeyGen.py
Created January 29, 2018 14:12 — forked from oliv2915/sshKeyGen.py
Python script that uses ssh-keygen and ssh-copy-id to create SSH keys
'''
Author: Brian Oliver II
Instagram: bolo_ne3
License:
MIT License
Copyright (c) 2016 Brian Oliver II
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
from projects_repository import ProjectsRepository
from project import Project
def load_all_items_from_database(repository):
print("Loading all items from database:")
projects = repository.read()
at_least_one_item = False
for p in projects:
at_least_one_item = True
from pymongo import MongoClient
from bson.objectid import ObjectId
from project import Project
class ProjectsRepository(object):
""" Repository implementing CRUD operations on projects collection in MongoDB """
def __init__(self):
# initializing the MongoClient, this helps to
# access the MongoDB databases and collections
from bson.objectid import ObjectId
class Project(object):
"""A class for storing Project related information"""
def __init__(self, project_id=None, title=None, description=None, price=0.0, assigned_to=None):
if project_id is None:
self._id = ObjectId()
else:
self._id = project_id
@hugobarzano
hugobarzano / create_index.sh
Created February 15, 2016 08:29 — forked from bonzanini/create_index.sh
Elasticsearch/Python test
curl -XPOST http://localhost:9200/test/articles/1 -d '{
"content": "The quick brown fox"
}'
curl -XPOST http://localhost:9200/test/articles/2 -d '{
"content": "What does the fox say?"
}'
curl -XPOST http://localhost:9200/test/articles/3 -d '{
"content": "The quick brown fox jumped over the lazy dog"
}'
curl -XPOST http://localhost:9200/test/articles/4 -d '{
@hugobarzano
hugobarzano / README.md
Created January 5, 2016 18:08 — forked from DamonOehlman/README.md
Provisioning of node + nginx designed for use with vagrant shell provisioner. No need for chef, puppet.

This is a simple shell script that is designed to provision both nginx and node on your machine. I primarily wrote it for use with Vagrant and an example Vagrantfile is included in the Gist as well.