Skip to content

Instantly share code, notes, and snippets.

View OneGneissGuy's full-sized avatar
🎯
Focusing

John Franco Saraceno OneGneissGuy

🎯
Focusing
View GitHub Profile
@OneGneissGuy
OneGneissGuy / SM_data.py
Last active August 1, 2016 15:40 — forked from mikshila/SM_data.py
Code for managing soil moisture data
# -*- coding: utf-8 -*-
"""
:DESCRIPTION:Code for managing soil moisture data
:REQUIRES:
:TODO:More error handling
:AUTHOR: John Franco Saraceno
:ORGANIZATION: U.S. Geological Survey, United States Department of Interior
:CONTACT: [email protected]
:VERSION: 1.0
Fri Jul 29 18:48:40 2016
@OneGneissGuy
OneGneissGuy / useful_pandas_snippets.py
Created September 6, 2016 05:57 — forked from bsweger/useful_pandas_snippets.md
Useful Pandas Snippets
# List unique values in a DataFrame column
pd.unique(df.column_name.ravel())
# Convert Series datatype to numeric, getting rid of any non-numeric values
df['col'] = df['col'].astype(str).convert_objects(convert_numeric=True)
# Grab DataFrame rows where column has certain values
valuelist = ['value1', 'value2', 'value3']
df = df[df.column.isin(valuelist)]
@OneGneissGuy
OneGneissGuy / buoyspectraplotter.py
Created August 14, 2017 17:28 — forked from mpiannucci/buoyspectraplotter.py
Parse Raw NDBC Directional Wave Spectra
import urllib.request as request
import json
import matplotlib.pyplot as plt
import matplotlib.colors as colors
import matplotlib.cm as cm
import numpy as np
class BuoySpectraPlotter:
def __init__(self, buoy_station):
#include <ESP8266WiFi.h>
#include <Wire.h>
#include <PubSubClient.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>
#define wifi_ssid "YOUR_WIFI_SSID"
#define wifi_password "YOUR_WIFI_PASSWORD"
#define mqtt_server "YOUR_MQTT_SERVER_HOST"
@OneGneissGuy
OneGneissGuy / lm35-to-thingspeak.lua
Created March 25, 2018 00:58 — forked from rock3m/lm35-to-thingspeak.lua
Detecting the indoor temperature using LM35, and send the periodic recordings to ThingSpeak via WiFi. See project details at https://medium.com/grace-learns-iot/day-7-monitoring-home-temperature-on-the-internet-26c175ee7200
--- Config
SSID = "YOUR_WIFI_NAME"
PASSWORD = "YOUR_WIFI_PASSWORD"
TIMEOUT = 30000000 -- 30s
--- Station modes
STAMODE = {
STATION_IDLE = 0,
STATION_CONNECTING = 1,
STATION_WRONG_PASSWORD = 2,
@OneGneissGuy
OneGneissGuy / ds18b20-nodemcu-v1.0-esp8266-arduino-ide.cpp
Created March 25, 2018 01:17 — forked from teos0009/ds18b20-nodemcu-v1.0-esp8266-arduino-ide.cpp
DS18B20 nodeMCU v1.0 with ESP8266 arduino IDE stream data to thingspeak
//nodeMCU v1.0 (black) with Arduino IDE
//stream temperature data DS18B20 with 1wire on ESP8266 ESP12-E (nodeMCU v1.0)
//shin-ajaran.blogspot.com
//nodemcu pinout https://github.com/esp8266/Arduino/issues/584
#include <ESP8266WiFi.h>
#include <OneWire.h>
#include <DallasTemperature.h>
//Def
#define myPeriodic 15 //in sec | Thingspeak pub is 15sec
@OneGneissGuy
OneGneissGuy / exif_gps.py
Created August 26, 2018 05:40 — forked from snakeye/exif_gps.py
Python: get GPS latitude and longitude coordinates from JPEG EXIF using exifread
import exifread
# based on https://gist.github.com/erans/983821
def _get_if_exist(data, key):
if key in data:
return data[key]
return None
@OneGneissGuy
OneGneissGuy / description.md
Created April 5, 2019 23:16 — forked from mangecoeur/description.md
Pandas PostgresSQL support for loading to DB using fast COPY FROM method

This small subclass of the Pandas sqlalchemy-based SQL support for reading/storing tables uses the Postgres-specific "COPY FROM" method to insert large amounts of data to the database. It is much faster that using INSERT. To acheive this, the table is created in the normal way using sqlalchemy but no data is inserted. Instead the data is saved to a temporary CSV file (using Pandas' mature CSV support) then read back to Postgres using Psychopg2 support for COPY FROM STDIN.

@OneGneissGuy
OneGneissGuy / git_update.sh
Created September 11, 2020 06:00 — forked from cacycleworks/git_update.sh
Simple sh script to automate a git update
#!/bin/sh
if [ $# != 2 ]; then
echo "\nchris k's git update automater sh script. Edit to put a bunch of \`git add blah'"
echo "lines in the body then evoke with the branch name and commit description\n"
echo "Usage: $0 <branch_name> <\"Description of update\">\n"
echo " branch_name: the name of the git branch to be created"
echo " Description: Text for: git commit -m \"Description of update\""
echo ""
echo "Example:"
BRANCH="core_override"
@OneGneissGuy
OneGneissGuy / .dockerfile
Created June 6, 2022 19:32 — forked from icarus44-zer0/.dockerfile
python:3.8.5-slim-buster- multi-stage - non-root - virtualenv
FROM python:3.8.5-slim-buster as base
LABEL maintainer="Your Name <[email protected]>" \
version="1.0.0"
RUN apt-get update && apt-get install tzdata -y --no-install-recommends
ENV TZ="America/Los_Angeles"
ENV PIP_NO_CACHE_DIR=1
ENV PIP_DISABLE_PIP_VERSION_CHECK=1