Skip to content

Instantly share code, notes, and snippets.

View nazt's full-sized avatar

Nat nazt

  • Chiang Mai Maker Club
  • Chiang Mai
  • X @nazt
View GitHub Profile
homeassistant:
# Name of the location where Home Assistant is running
name: Home
# Location required to calculate the time the sun rises and sets
latitude: 0
longitude: 0
# Impacts weather/sunrise data (altitude above sea level in meters)
elevation: 0
# metric for Metric, imperial for Imperial
unit_system: metric
@nazt
nazt / single
Created October 19, 2019 03:52 — forked from tibaes/single
IPython display cv images
# Using docker goldenheart:1.1.0
# pip3 install matplotlib
# Import the required modules
%pylab inline
import cv2
from IPython.display import clear_output
frame = cv2.imread("image.jpg")
frame = cv2.cvtColor(frame, cv2.COLOR_RGB2BGR)
from matplotlib import pyplot as plt
import cv2
img = cv2.imread('/Users/mustafa/test.jpg')
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
plt.imshow(gray)
plt.title('my picture')
plt.show()
@nazt
nazt / showarray.py
Created October 18, 2019 06:37 — forked from kylemcdonald/showarray.py
Minimal code for rendering a numpy array as an image in a Jupyter notebook in memory. Borrowed from the Deep Dream notebook.
import PIL.Image
from cStringIO import StringIO
import IPython.display
import numpy as np
def showarray(a, fmt='png'):
a = np.uint8(a)
f = StringIO()
PIL.Image.fromarray(a).save(f, fmt)
IPython.display.display(IPython.display.Image(data=f.getvalue()))
@nazt
nazt / keras-mac.py
Created October 11, 2019 13:03
keras-mac.py
import time
import numpy as np
import cv2
from PIL import Image
import keras
from keras import backend as K
from keras.layers.core import Dense
from keras.optimizers import Adam
from keras.metrics import categorical_crossentropy
from keras.preprocessing.image import ImageDataGenerator
#!/bin/bash
SHELL=/bin/bash
VERSION=0.0.1
usage() {
cat <<EOF
$0 v$VERSION
Usage: $0 [-v|--help]
EOF
exit 1
}
@nazt
nazt / 1-standard.js
Created August 25, 2019 15:05 — forked from vladfr/1-standard.js
Use async/await and for..of in Cloud Firestore
// In a Firestore standard example, we quickly create a 'xmas tree' of nested stuff
// We use Promises directly: get().then(callback) and use snapshot.forEach() to iterate
let campaignsRef = db.collection('campaigns');
let activeCampaigns = campaignsRef.where('active', '==', true).select().get()
.then(snapshot => {
snapshot.forEach(campaign => {
console.log(campaign.id);
let allTasks = campaignsRef.doc(campaign.id).collection('tasks').get().then(
snapshot => {
snapshot.forEach(task => {
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf
{0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0xffe0,0
const path = require('path');
module.exports = {
rootDir: path.resolve(__dirname, '.'),
moduleFileExtensions: [
'js',
'json',
'vue',
],
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1',