Skip to content

Instantly share code, notes, and snippets.

View masayang's full-sized avatar

Masa Nakamura masayang

View GitHub Profile
import logging
from pylons import config, request, response, session, tmpl_context as c
from pylons.controllers.util import abort, redirect_to, url_for
from rpxclock.lib.base import BaseController, render
log = logging.getLogger(__name__)
import urllib2
from sforce.enterprise import SforceEnterpriseClient
h = SforceEnterpriseClient('/home/user/.conf/enterprise.wsdl.xml')
h.login('user1@yourdomain.com', 'password', 'securitytoken')
lead = h.generateObject('Lead')
lead.FirstName = 'Masayoshi'
lead.LastName = 'Nakamura'
lead.Company = 'Masasushi, Inc.'
lead.Email = 'masayang@hogehogehoge.com'
result = h.create(lead)
@masayang
masayang / Git練習用.txt
Created October 4, 2012 23:08
Git練習用
Git練習用
Git練習用
Git練習用
Git練習用
Git練習用
Git練習用
Git練習用
Git練習用
Git練習用
Git練習用
@masayang
masayang / indent.py
Created October 5, 2012 00:23
インデント重要
sum = 0
for i in range(1, 11):
sum = sum + i
print sum
@masayang
masayang / classes.py
Created October 5, 2012 01:35
関数とクラス
class Stuffy(object):
def __init__(self, s = None):
self.buffer = s
def eek(self):
return self.buffer
if __name__ == '__main__':
s1 = Stuffy(10)
s2 = Stuffy(20)
@masayang
masayang / module.py
Created October 5, 2012 01:39
モジュールの使い方例
import sys
if __name__ == '__main__':
print sys.argv
@masayang
masayang / virtualenv.sh
Created October 5, 2012 01:48
Virtualenv
$ source virtualenvwrapper.sh
$ lsvirtualenv
bootcamp1
$ workon bootcamp1
(bootcamp1)$ lssitepackages
dateutil pylab.pyc
easy-install.pth pytz
matplotlib scikit_learn-0.12-py2.7.egg-info
matplotlib-1.1.1-py2.7.egg-info scipy
mpl_toolkits scipy-0.11.0-py2.7.egg-info
@masayang
masayang / Iris.txt
Created October 6, 2012 02:12
Ggobiの導入とIrisデータセットの取得
Irisデータセットの取得
Shellから
$ wget http://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data
GUIから
ブラウザで http://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data を開き、データをダウンロード
@masayang
masayang / simpleLR.py
Created October 9, 2012 00:49
簡単なLinear Regression例
import numpy as np
from sklearn import linear_model
import matplotlib.pyplot as plt
X = np.array([[0], [1], [2], [3]])
Y = np.array([0.1, 1.1, 1.8, 2.7])
regr = linear_model.LinearRegression()
regr.fit(X, Y)
@masayang
masayang / twodim.py
Created October 9, 2012 01:03
配列でデータが来る場合のLinear Regression
import numpy as np
from sklearn import linear_model
import matplotlib.pyplot as plt
array = np.array([[0, 0.1], [1, 1.1], [2, 1.8], [3, 2.7]])
print array
X = array[:, 0:1]
Y = array[:, 1]