Skip to content

Instantly share code, notes, and snippets.

@ypwhs
ypwhs / transfer_learning.ipynb
Created October 5, 2017 08:15
Keras Inception + Xception (0.47)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bembengarifin
bembengarifin / upsert_table.sql
Last active April 24, 2020 08:01
mysql bulk insert, with duplicate key update (upsert), and with conditional data update
/*
references:
- https://dev.mysql.com/doc/refman/5.7/en/insert-on-duplicate.html
- https://stackoverflow.com/questions/32777081/bulk-insert-and-update-in-mysql
- https://thewebfellas.com/blog/conditional-duplicate-key-updates-with-mysql
*/
/* create a new database and use it */
drop database if exists test_upsert;
create database test_upsert;
@kevinzakka
kevinzakka / data_loader.py
Last active April 19, 2024 23:42
Train, Validation and Test Split for torchvision Datasets
"""
Create train, valid, test iterators for CIFAR-10 [1].
Easily extended to MNIST, CIFAR-100 and Imagenet.
[1]: https://discuss.pytorch.org/t/feedback-on-pytorch-for-kaggle-competitions/2252/4
"""
import torch
import numpy as np
@dmlap
dmlap / reload-source-on-error.md
Last active July 21, 2023 02:05
Basic instructions for the reloadSourceOnError plugin.

Using the reloadSourceOnError Plugin

Call the plugin activate it:

player.reloadSourceOnError()

Now if the player encounters a fatal error during playback, it will automatically attempt to reload the current source. If the error was caused by a transient browser or networking problem, this can allow playback to continue with a minimum of disruption to your viewers.

#!/usr/bin/env python3
# -*- utf8 -*-
# author=dave.fang@outlook.com
# create=20160425
import requests
import gevent.pool
import gevent.monkey
import sys
MAX_TRY_COUNT = 3
THREADS = 30