Skip to content

Instantly share code, notes, and snippets.

@yongjun823
yongjun823 / down.py
Last active June 30, 2018 15:22
open image csv read and Image Down using ThreadPool ++ blank image remove
import csv
import requests
import shutil
import os
import argparse
import numpy as np
import time
from tqdm import tqdm
from PIL import Image, ImageOps
from concurrent.futures import ThreadPoolExecutor
@yongjun823
yongjun823 / async_function.js
Created June 3, 2018 05:27
async await promise all test
function Firebase1() {
return new Promise(resolve => {
db.collection("ReceivedTransferFinAccount").get().then((querySnapshot) => {
const data = []
querySnapshot.forEach((doc) => {
data.push(doc.data())
});
@yongjun823
yongjun823 / mp4_split.py
Last active May 22, 2018 03:14
single mp4 file split with python, ffmpeg
# reference
# https://github.com/c0decracker/video-splitter
import math
import re
import subprocess
import os
length_regexp = 'Duration: (\d{2}):(\d{2}):(\d{2})\.\d+,'
re_length = re.compile(length_regexp)
@yongjun823
yongjun823 / pytorch_load.py
Last active May 2, 2018 07:19
pytorch load pretraining model
import torch
from torch.autograd import Variable
from udacity_car.data_loader import img_road_path
model = torch.load('model.pkl')
img_tensor = img_road_path(['./img/temp.jpg'])
img_tensor.unsqueeze_(0)
tt = Variable(img_tensor)
@yongjun823
yongjun823 / example.cpp
Created April 30, 2018 13:58
mfc example pen color & bold controll
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
int wmId, wmEvent;
PAINTSTRUCT ps;
HDC hdc;
POINTS pt;
static int x;
static int y;
static bool isDraw = false;
@yongjun823
yongjun823 / program.cs
Created April 30, 2018 05:58
people management exmaple
using System;
using System.Collections.Generic;
namespace PeopleManagement
{
class Person
{
public int Number;
public string Name;
public string Phone, Email, year;
@yongjun823
yongjun823 / mp4_convert.py
Last active April 21, 2018 07:58
1) Input as video input and receive as flac result 2) Upload flac file to cloud storege 3) Extract text by voice recognition 4) Save video name & text to fire store
from __future__ import print_function # for compatibility with both python 2 and 3
from subprocess import call # for calling mplayer and lame
import os # help with file handling
def check_file_exists(directory, filename, extension):
path = directory + "/" + filename + extension
return os.path.isfile(path)
@yongjun823
yongjun823 / realtime.java
Created December 21, 2017 12:34
DataSnapshot
Iterable<DataSnapshot> dataSnapshots = dataSnapshot.getChildren();
for (DataSnapshot tempSnapshot : dataSnapshots) {
String value = tempSnapshot.getValue().toString();
String key = tempSnapshot.getKey();
if (key.equals("num")) {
Log.e(TAG, value);
} else if (key.equals("value")) {
Log.e(TAG, value);
@yongjun823
yongjun823 / mapAPI.java
Created December 18, 2017 10:28
google map api - geocoding, direct
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.maps.DirectionsApi;
import com.google.maps.GeoApiContext;
import com.google.maps.GeocodingApi;
import com.google.maps.errors.ApiException;
import com.google.maps.model.DirectionsResult;
import com.google.maps.model.GeocodingResult;
import com.google.maps.model.TravelMode;
import numpy as np
import pandas as pd
import tensorflow as tf
train = pd.read_csv("data_bike/train.csv", parse_dates=["datetime"])
test = train[:2000]
train= train[2000:]
feature=['temp', 'atemp', 'humidity', 'windspeed', 'casual', 'registered']