Skip to content

Instantly share code, notes, and snippets.

@kawaz
kawaz / .gitmodules
Created May 30, 2012 02:21
.gitmodulesにいつも書いてるメモ
# submoduleの削除手順
# 1: .gitmodules から削除したいサブモジュール設定を削除
# 2: .git/config から削除したいサブモジュール設定を削除
# 3: git rm --cached -r path/to/submodule を実行
@STAR-ZERO
STAR-ZERO / FontFitTextView.java
Created June 15, 2012 03:18
【Android】横幅に合わせてテキストサイズを調整するTextView
import android.content.Context;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.widget.TextView;
/**
* サイズ自動調整TextView
*
*/
@ck-on
ck-on / ocp.php
Last active May 18, 2024 22:35
OCP - Opcache Control Panel (aka Zend Optimizer+ Control Panel for PHP)#ocp #php #opcache #opcode #cache #zend #optimizerplus #optimizer+
<?php
/*
OCP - Opcache Control Panel (aka Zend Optimizer+ Control Panel for PHP)
Author: _ck_ (with contributions by GK, stasilok)
Version: 0.1.7
Free for any kind of use or modification, I am not responsible for anything, please share your improvements
* revision history
0.1.7 2015-09-01 regex fix for PHP7 phpinfo
0.1.6 2013-04-12 moved meta to footer so graphs can be higher and reduce clutter
@meineerde
meineerde / nginx.conf
Created March 13, 2013 10:11
Check the Accept-Language Header to emulate part of Apache's content negotiation features. This is based on http://stackoverflow.com/questions/3657614/how-to-rewrite-location-in-nginx-depending-on-the-client-browsers-language
map $http_accept_language $lang {
default en;
~de de;
~en en;
}
location /foo/bar/baz/lang.js {
try_files $uri.$lang $uri;
}
@odoku
odoku / debug_smtp.py
Created October 29, 2013 03:30
デバッグ用のSMTPサーバー。 起動すると送信したメールの内容がコンソールに出力されるよ。 日本語対応済。
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import smtpd
import asyncore
import email
from email.message import Message
from email.header import decode_header
from email.utils import parseaddr
from optparse import OptionParser
@even4void
even4void / .emacs
Last active September 6, 2018 15:26
A basic previewer for R Markdown files edited with Emacs
(add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode))
(add-to-list 'auto-mode-alist '("\\.Rmd\\'" . markdown-mode))
(add-to-list 'auto-mode-alist '("\\.rmd\\'" . markdown-mode))
(add-hook 'markdown-mode-hook 'turn-on-outline-minor-mode)
(defun rmarkdown-new-chunk (name)
"Insert a new R chunk."
(interactive "sChunk name: ")
(insert "\n```{r " name "}\n")
(save-excursion
@rezoo
rezoo / caffe.md
Last active November 4, 2021 15:28

Caffe tutorial

この文章ではCNN実装であるCaffeを用いて,特徴ベクトルの抽出やパラメータの学習を行うための方法について説明する.

Caffeでサポートされている機能

以下の作業を行いたいのであれば,Caffeを用いることが望ましい.

  • CNNを利用した画像の多クラス分類
  • CNNによる特徴ベクトルの抽出
  • CNNの転移学習
  • Stacked Auto Encoder
@komasaru
komasaru / population_density_pref.R
Last active April 25, 2022 05:55
R script to generate a choropleth map of Japan's population density.
# ライブラリの読み込み
library(gpclib)
library(ggplot2)
library(maptools)
library(classInt)
library(RColorBrewer)
# gpclib ライセンス警告表示の抑止
gpclibPermit()
@zph
zph / direnv.el
Last active March 30, 2017 16:29
(require 'cl-lib)
;; Depends on s.el
(defun direnv-data (dir)
;; TODO: use dir for folder or smart current-project-dir variable
(let ((cmd (concat "$SHELL -i -c '" "cd " dir " && direnv export bash'")))
(shell-command-to-string cmd)))
;;(direnv-data "~/src/direnv")
(defun commands-from-direnv (text)
#!/usr/bin ipython
import numpy as np
# data
X = np.asarray([(1.0, 1.0), (1.5, 2.0), (3.0, 4.0), (5.0, 7.0), (3.5, 5.0), (4.5, 5.0), (3.5, 4.5)])
# Loyds algorithm with Forgy method
import random
# euclidian distance