Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View kivantium's full-sized avatar

Kawana Kiyoshi kivantium

View GitHub Profile
@kivantium
kivantium / lecture2.v
Last active April 9, 2023 23:31
Coq_practice
(* https://www.math.nagoya-u.ac.jp/~garrigue/lecture/2017_AW/coq2.pdf *)
Section Coq2.
Variables P Q R : Prop.
Theorem imp_trans : (P -> Q) -> (Q -> R) -> P -> R.
Proof.
intros pq qr p.
apply qr; apply pq; assumption.
Qed.
@kivantium
kivantium / adversarial.py
Created August 1, 2022 03:05
Adversarial Exampleで作る"エロ画像" ソースコード(ライセンスはMIT-0です)
import copy
import i2v
import numpy as np
from PIL import Image
from skimage.transform import resize
image_size = 224
channel_size = 3
noise_size = 56
import json
import re
import time
import arxiv
from slackclient import SlackClient
slack_token = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
sc = SlackClient(slack_token)
import cv2
image = cv2.imread("test.png")
imgray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
ret, thresh = cv2.threshold(imgray, 0, 255, cv2.THRESH_BINARY+cv2.THRESH_OTSU)
image2, contours, hierarchy = cv2.findContours(thresh,cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE)
result = cv2.drawContours(image, contours, -1, (0,255,0), 5)
cv2.imwrite("result.png", result)
@kivantium
kivantium / 解析ログ.ipynb
Last active December 30, 2017 05:23
大手ヘッジファンドX: 金融モデリングチャレンジ 実験記録
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kivantium
kivantium / ipywidgets.ipynb
Created June 10, 2017 13:43
ipywidgetsのサンプル
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/usr/bin/python
#-*- coding: utf-8 -*-
from requests_oauthlib import OAuth1Session
import json
import HTMLParser
CK = 'XXXXXXXXXXXXXXXXXXXXXX' # Consumer Key
CS = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' # Consumer Secret
AT = 'XXXXXXXXX-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' # Access Token
@kivantium
kivantium / get_access_token.py
Created November 10, 2016 06:47
GNU Social from Python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import requests
from requests_oauthlib import OAuth1Session
from requests_oauthlib import OAuth1
from urlparse import parse_qs
# アプリのページから取得したkey, secretを入力
client_key = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
/**
* You can modify and use this source freely
* only for the development of application related Live2D.
* <p>
* (c) Live2D Inc. All rights reserved.
*/
package jp.live2d.sample;
import jp.live2d.utils.android.FileManager;
@kivantium
kivantium / chainer_caffenet_prediction.py
Created January 25, 2016 08:45
Chainer with Caffenet example
#!/usr/bin/env python
"""
Chainer sample code to predict labels for a given image based on pre-trained CaffeNet model
Before running this code, you must execure
$ ./download_model.py caffenet
$ ./download_mean_file.py
$ wget http://dl.caffe.berkeleyvision.org/caffe_ilsvrc12.tar.gz
$ tar zxvf caffe_ilsvrc12.tar.gz