Skip to content

Instantly share code, notes, and snippets.

View kenwalger's full-sized avatar

Ken W. Alger kenwalger

View GitHub Profile
@kenwalger
kenwalger / MongoJava.java
Created February 2, 2016 06:33
MongoDB CRUD in Java
import com.mongodb.ErrorCategory;
import com.mongodb.MongoClient;
import com.mongodb.MongoClientURI;
import com.mongodb.MongoWriteException;
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoCursor;
import com.mongodb.client.MongoDatabase;
import com.mongodb.client.model.Filters;
import org.bson.Document;
import pprint
from pymongo import MongoClient
__author__ = 'Ken W. Alger'
HOST = 'localhost'
PORT = 27017
@kenwalger
kenwalger / temp_sensor.py
Created June 13, 2017 05:11
MicroPython Temperature Sensor for the NodeMCU ESP8266.
from machine import ADC
adc = ADC(0) # assign to the analog to digital 0 pin
adc.read() # returns TMP 36 value
def temp(value):
return value/10
@kenwalger
kenwalger / app.py
Created June 12, 2018 23:24
PyMongo Sample for Advocacy Hub
from pymongo import MongoClient
import datetime
client = MongoClient('localhost', 27017)
db = client['advocacy-hub-db']
collection = db['pyMongo']
@kenwalger
kenwalger / Program.cs
Last active December 18, 2020 16:34
C# and MongoDB: Read Operation Quick Start
using System;
using MongoDB.Bson;
using MongoDB.Driver;
namespace MongoDBCRUDExample
{
class Program
{
static void Main(string[] args)
@kenwalger
kenwalger / Program.cs
Last active May 1, 2024 10:38
C# and MongoDB Update Operation
using System;
using MongoDB.Bson;
using MongoDB.Driver;
namespace MongoDBCRUDExample
{
class Program
{
static void Main(string[] args)
@kenwalger
kenwalger / Program.cs
Created October 23, 2019 14:28
C# and MongoDB Delete Operation
using System;
using MongoDB.Bson;
using MongoDB.Driver;
namespace MongoDBCRUDExample
{
class Program
{
static void Main(string[] args)