Skip to content

Instantly share code, notes, and snippets.

docker images | awk '/<none/{print $3}' | xargs docker rmi
docker ps -f "status=exited" -q | xargs docker rm
@satomacoto
satomacoto / dsdr.py
Created December 10, 2012 04:54
[He 2012] Document Summarization based on Data Reconstruction
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
class DSDR:
"""Z He, et al. Document Summarization based onData Reconstruction (2012)
http://www.aaai.org/ocs/index.php/AAAI/AAAI12/paper/viewPaper/4991
"""
curl -fsSL https://gist.githubusercontent.com/satomacoto/b27dc3f871938d2614819bba3c589b45/raw/setup1.sh | bash
curl -fsSL https://gist.githubusercontent.com/satomacoto/b27dc3f871938d2614819bba3c589b45/raw/setup2.sh | bash
@satomacoto
satomacoto / mparser.py
Created April 12, 2012 03:25
Parser with MeCab
#! /usr/bin/python
# -*- encoding: utf-8 -*-
'''
Parser with MeCab
'''
import MeCab
import glob
import re
import os
@satomacoto
satomacoto / lda.py
Created January 11, 2012 13:18
LDA
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys,getopt
from numpy import array,matrix,diag
from scipy import sum,log,exp,mean,dot,ones,zeros
from scipy.special import polygamma
from scipy.linalg import norm
from random import random
pyenv install miniconda3-latest
pyenv local miniconda3-latest
conda create -n myenv anaconda
source (conda info --root)/etc/fish/conf.d/conda.fish
conda activate myenv
@satomacoto
satomacoto / Twitter API with Curl
Created September 9, 2017 01:12 — forked from apolloclark/Twitter API with Curl
Twitter API with Curl
# create an account, create an app
# @see https://apps.twitter.com/
# retrieve the access tokens
# @see https://dev.twitter.com/oauth/reference/post/oauth2/token
# create the file ~/twitter_api
nano ~/twitter_api
Authorization: OAuth oauth_consumer_key="XXXXXX", oauth_nonce="11111111", oauth_signature="XXXXXX", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1450728725", oauth_token="99999-XXXXXX", oauth_version="1.0"
@satomacoto
satomacoto / labeledarrow.html
Created August 18, 2012 06:56
labeled arrow w/ D3.js
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<script src="http://d3js.org/d3.v2.js"></script>
<style>
line.arrow {
stroke: #666;
@satomacoto
satomacoto / cooccur-top20.txt
Last active March 24, 2017 05:52
count tag occurrence and cooccurrence on xvideos.com-db.csv
('blowjob', 'hardcore') 594241
('blowjob', 'brunette') 336485
('blowjob', 'teen') 334746
('amateur', 'teen') 322670
('brunette', 'hardcore') 320892
('hardcore', 'teen') 302974
('blonde', 'brunette') 282348
('blonde', 'blowjob') 272567
('blowjob', 'oral') 269461
('blonde', 'hardcore') 252474
# -*- coding: utf-8 -*-
import pandas as pd
import numpy as np
from sklearn.datasets import load_digits
from sklearn import grid_search, metrics
from sklearn.pipeline import Pipeline, FeatureUnion
from sklearn.linear_model import LogisticRegression, RidgeClassifier, PassiveAggressiveRegressor, ElasticNet
from sklearn.ensemble import GradientBoostingRegressor, ExtraTreesRegressor, RandomForestRegressor
from sklearn.neighbors import KNeighborsClassifier, KNeighborsRegressor