Skip to content

Instantly share code, notes, and snippets.

View jinhoyoo's full-sized avatar

Jinho Yoo jinhoyoo

View GitHub Profile
@jinhoyoo
jinhoyoo / gmail_test_code.py
Created October 31, 2014 15:52
Send e-mail on Gmail by python
def send_email( gmail_user, gmail_pwd, mail_from, mail_to, title, message ):
import smtplib
# Prepare actual message
message = """\From: %s\nTo: %s\nSubject: %s\n\n%s
""" % (mail_from, ", ".join(mail_to), title, message)
try:
#server = smtplib.SMTP(SERVER)
server = smtplib.SMTP("smtp.gmail.com", 587) #or port 465 doesn't seem to work!
server.ehlo()
@jinhoyoo
jinhoyoo / example_flask_testing.py
Last active November 24, 2015 08:34
Example: Flask test with unittest
import os
from datalibs import app
import unittest
class AppViewTestCase(unittest.TestCase):
def setUp(self):
app.config['TESTING'] = True
self.app = app.test_client()
def tearDown(self):
@jinhoyoo
jinhoyoo / live_flask_testing_exmaple.py
Last active December 21, 2020 20:50
flask-testing: LiveServerTestCase example
import urllib2
from datalibs import app
import unittest
from flask import Flask
from flask.ext.testing import LiveServerTestCase
class MyTest(LiveServerTestCase):
def create_app(self):
app.config['TESTING'] = True
@jinhoyoo
jinhoyoo / external_exe_on_spark_cluster.py
Last active December 24, 2015 02:25
Spark clustering example code
from pyspark import SparkContext
from subprocess import call, check_output
import numpy as np #Spark has numpy for python.
def run(sc):
data = [np.arange(0, 99), np.arange(100, 200) ]
distData=sc.parallelize(data)
sc.addFile("/master/sum_of_numbers")
tesseract --tessdata-dir ./ ./TestSet2/name.png name -l kor -psm 8
tesseract --tessdata-dir ./ ./TestSet2/id_number.png id_number -l kor -psm 8
tesseract --tessdata-dir ./ ./TestSet2/address.png address -l kor -psm 6
tesseract --tessdata-dir ./ ./TestSet2/printed_date.png printed_date -l kor -psm 3
tesseract --tessdata-dir ./ target.png -l kor -psm 0
@jinhoyoo
jinhoyoo / linear_regression_tf.py
Created June 14, 2016 03:46
tenssor flow: linear regression
import tensorflow as tf
x1_data = [1, 0, 3, 0, 5]
x2_data = [0, 2, 0, 4, 0]
y_data = [1, 2, 3, 4, 5]
W1 = tf.Variable(tf.random_uniform([1], -1.0, 1.0) )
W2 = tf.Variable(tf.random_uniform([1], -1.0, 1.0) )
b = tf.Variable(tf.random_uniform([1], -1.0, 1.0) )
@jinhoyoo
jinhoyoo / imageProcessing.cs
Created March 3, 2017 05:29 — forked from y6a2/imageProcessing.cs
opencv/samples/cpp/squares.cpp to unity @iphone5 Using NativePlugin
using UnityEngine;
using System.Collections;
using System.Runtime.InteropServices;
public class imageProcessing : MonoBehaviour {
[DllImport ("__Internal")]
private static extern void UpdateTexture(System.IntPtr colors, int width, int height);
WebCamTexture webcamTexture;
Texture2D texture = null;
@jinhoyoo
jinhoyoo / aio_test.py
Created September 20, 2017 06:45
aio example.
from aiohttp import web
import json
async def index(request):
return web.Response(text='Hello Aiohttp!')
async def post_todo(request):
body = await request.json()
return web.Response(body=json.dumps(body).encode('utf-8'))
curl http://192.168.100.155:9000/api/v1/transactions/result?hash=03aaafbf3dc8bc4b7e78f0ec1153722957b2d3a58366dbe6f364a6930650e21b&channel=nia_kyobo_claim
curl http::localhost:9000/api/v1/transactions/result?hash=03aaafbf3dc8bc4b7e78f0ec1153722957b2d3a58366dbe6f364a6930650e21b&channel=nia_kyobo_claim
asdasd
@jinhoyoo
jinhoyoo / gist:1eee3e6fd4fcaf511de34a425605faff
Created October 18, 2018 02:37 — forked from jmvrbanac/gist:7920633
Using pyenv virtualenvs in a Jenkins Job
#!/bin/bash
set +x
# Setup all of the pyenvs
export PATH="$HOME/.pyenv/bin:$PATH"
export CONFIGURE_OPTS='--enable-shared'
eval "$(pyenv init -)"
pyenv shell 2.7.5
pyenv virtualenvwrapper
pyenv rehash