Skip to content

Instantly share code, notes, and snippets.

# Use the official Python image.
# https://hub.docker.com/_/python
FROM python:3.8
# Copy local code to the container image.
ENV APP_HOME /app
WORKDIR $APP_HOME
COPY . .
# Install production dependencies.
@nwatab
nwatab / fetch_xeno_canto.py
Created August 24, 2020 04:56
Fetch A class bird song .mp3's recorded in Japan from XENO CANTO
import requests
import os
// page has 1 to 4
url = 'https://www.xeno-canto.org/api/2/recordings?query=cnt:japan+q:a&page=1'
res = requests.get(url, headers={'Accept-language': 'ja'}).json()
def download_media(url, filename):
try:
res = requests.get(medialink)
@nwatab
nwatab / LazyCardMedia.tsx
Created August 17, 2020 00:20
Lazy load image in Material-UI Card Media
import React, {useState, useEffect, useRef} from 'react'
import { CardMedia } from '@material-ui/core'
interface ICardMediaProp {
component: string,
image: string,
alt: string,
height: string,
}
export default (props: ICardMediaProp) => {
@nwatab
nwatab / resnet50.py
Last active August 28, 2020 13:03
Tensorflow v1 primitive implementation of ResNet50. Change output activation from ReLU to what you like
import tensorflow as tf
"""
Thanks to
https://cv-tricks.com/keras/understand-implement-resnets/
https://qiita.com/gucchi0403/items/097d83f0e8a6091c1240
"""
def resnet(inpt, out_units):
def weight_variable(shape, name=None):
@nwatab
nwatab / main.ino
Created May 18, 2020 04:49
Upload M5Camera to Google Drive periodically
#include "esp_camera.h"
#include <WiFi.h>
#include <WiFiClientSecure.h>
#include <DNSServer.h>
#include <WebServer.h>
#include <FS.h>
#include <SPIFFS.h>
//#define M5CAM_MODEL_A
#define M5CAM_MODEL_B
@nwatab
nwatab / App.js
Last active February 6, 2022 15:42
React Native Hooks (Expo) and Navigation v5 - Splash + Auth + Drawer + Tabs (https://www.youtube.com/watch?v=nQVCkqvU1uE&t)
import React, {useState, useEffect} from 'react';
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
import { createDrawerNavigator } from "@react-navigation/drawer";
import { Splash, SignIn, CreateAccount, Details, Home, Search, Search2, Profile} from './Screens';
import { AuthContext } from './context';
const AuthStack = createStackNavigator();
@nwatab
nwatab / App.js
Last active April 16, 2020 10:21
ReactNative FlatList sample
// For swipable row, https://github.com/GeekyAnts/NativeBase/issues/1430#issuecomment-350243994
// Wait, SwipeRow is remooved https://docs.nativebase.io/Components.html#swipeable-multi-def-headref
// Use react-native-swipe-list-view
import React, { useState } from 'react';
import { StyleSheet, Text, FlatList, StatusBar } from 'react-native';
import { Container, Content, Header, Input, Item, Button, ListItem, Icon, View} from 'native-base'
export default function App() {
const data = [{key: '0', title: 'Washington'}, {key: '1', title: 'Adams'}, {key: '2', title: 'Jefferson'}]
@nwatab
nwatab / App.js
Last active April 25, 2020 14:02
Login page with Firebase and React Native (Native Base)
import React, { useState } from 'react';
import { StyleSheet, Text, View } from 'react-native';
import { Container, Content, Header, Form, Input, Item, Button, Label} from 'native-base'
import * as firebase from 'firebase';
const firebaseConfig = {
apiKey: "XXX",
authDomain: "xxx.firebaseapp.com",
databaseURL: "https://xxx.firebaseio.com",
import tensorflow as tf
tf.reset_default_graph()
img_h = img_w = 28
img_size_flat = img_h * img_w
n_classes = 10