This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(shiny) | |
library(twitteR) | |
library(RMeCab) | |
library(wordcloud) | |
options(encoding='UTF-8') | |
Sys.setlocale("LC_ALL", "ja_JP.UTF-8") | |
# Tweetに絵文字が含まれると"&"の置換でエラーとなるため該当のTweetをNAにする | |
remove.emoji <- function(x) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-1:-53 なるほど、わからん id:BAG85NBK9Idp1FVTLS1xVfgg4lM | |
0:12 ぱちぱち id:eRE0y9SF7uZs8lsiDyVPYiHni5Q | |
0:36 プログラマー乙 id:OXUAdFmNJvZ7pnvflx8gb7jFu8g | |
1:56 電通いくん id:2NheN3H0BzZAIkV7-egRNyqOOis | |
2:44 すげーいい試み id:DmrIJLCLceiDDhmDpwjwgbg8EP0 | |
2:58 頑張れ頑張れ id:DmrIJLCLceiDDhmDpwjwgbg8EP0 | |
3: 1 絵は2次元だったな id:0dQP-sxzJhPBQ7SMVfJ_R7b5hKo | |
3:15 ポアソン分布にみえない id:2NheN3H0BzZAIkV7-egRNyqOOis | |
3:16 俺」BIGDATAの会社いっぱいしっているから教ええるよ id:DmrIJLCLceiDDhmDpwjwgbg8EP0 | |
3:36 帰無仮説 id:DmrIJLCLceiDDhmDpwjwgbg8EP0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<source> | |
type twitter | |
consumer_key YOUR_CONSUMER_KEY # Required | |
consumer_secret YOUR_CONSUMER_SECRET # Required | |
oauth_token YOUR_OAUTH_TOKEN # Required | |
oauth_token_secret YOUR_OAUTH_TOKEN_SECRET # Required | |
tag twitter.raw.tracking # Required | |
timeline tracking # Required (tracking or sampling or userstream) | |
keyword CB,MNP,キャッシュバック # Optional (keyword is priority than follow_ids) | |
lang ja # Optional |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## comments are retained; | |
# a comment block will be reflowed if it contains long comments; | |
#' roxygen comments will not be wrapped in any case | |
1+1 | |
if(TRUE){ | |
x=1 # inline comments | |
}else{ | |
x=2;print('Oh no... ask the right bracket to go away!')} | |
1*3 # one space before this comment will become two! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import sys | |
spark_home = os.environ.get('SPARK_HOME', None) | |
if not spark_home: | |
raise ValueError('SPARK_HOME environment variable is not set') | |
sys.path.insert(0, os.path.join(spark_home, 'python')) | |
sys.path.insert(0, os.path.join(spark_home, 'python/lib/py4j-0.8.2.1-src.zip')) | |
execfile(os.path.join(spark_home, 'python/pyspark/shell.py')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# comma-separated whitelist of users that can spawn single-user servers | |
Runas_Alias JUPYTER_USERS = [user1], [user2] | |
# the command(s) the Hub can run on behalf of the above users without needing a password | |
# the exact path may differ, depending on how sudospawner was installed | |
Cmnd_Alias JUPYTER_CMD = /usr/bin/sudospawner | |
# actually give the Hub user permission to run the above command on behalf | |
# of the above users without prompting for a password | |
jupyter ALL=(JUPYTER_USERS) NOPASSWD:JUPYTER_CMD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
c.JupyterHub.db_url = 'sqlite:////etc/jupyterhub/jupyterhub.sqlite' | |
c.JupyterHub.base_url = '/jupyter/' | |
c.JupyterHub.ssl_key = '[鍵ファイルのパス]' | |
c.JupyterHub.ssl_cert = '[証明書ファイルのパス]' | |
c.JupyterHub.cookie_secret_file = '/etc/jupyterhub/jupyterhub_cookie_secret' | |
c.Authenticator.admin_users = {'管理者ユーザー1', '管理者ユーザー2'} | |
c.JupyterHub.port = [ポート] | |
c.Spawner.notebook_dir = '~/notebooks' | |
c.Authenticator.whitelist = {'管理者ユーザー1', '管理者ユーザー2', '一般ユーザー1', '一般ユーザー2'} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# .bashrc | |
# Source global definitions | |
if [ -f /etc/bashrc ]; then | |
. /etc/bashrc | |
fi | |
# User specific aliases and functions | |
if [ -f /usr/bin/virtualenvwrapper.sh ]; then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
c.NotebookApp.ip = '*' | |
c.NotebookApp.open_browser = False | |
c.NotebookApp.port = 9999 # or whatever you want; be aware of conflicts with CDH | |
PWDFILE='パスワードファイルのパス' | |
c.NotebookApp.password = open(PWDFILE).read().strip() | |
c.NotebookApp.base_url = '/jupyter/' | |
c.NotebookApp.webapp_settings = {'static_url_prefix':'/jupyter/static/'} | |
c.NotebookApp.certfile = u'証明書ファイル(*.pem)のパス' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(httr) | |
# ネット上の画像の場合はJSONでURLをPOST | |
res <- POST(url = 'https://api.projectoxford.ai/face/v0/detections', | |
query = list(analyzesFaceLandmarks=TRUE, | |
analyzesAge=TRUE, | |
analyzesGender=TRUE, | |
analyzesHeadPose=TRUE), | |
add_headers('Content-Type' = 'application/json', | |
'Ocp-Apim-Subscription-Key' = '[Subscription key]'), |
OlderNewer