Skip to content

Instantly share code, notes, and snippets.

edvakf

Block or report user

Report or block edvakf

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:a871d5606ae5a3122c84000009477681
# apache2を再起動
sudo systemctl restart apache2
# apache2の設定を再読み込み
sudo systemctl reload apache2
# apache2を止める
sudo systemctl stop apache2
View ssh_config
Host handson
User admin
Port 22
IdentityFile インスタンスを作るときにダウンロードしたpemファイル
HostName パブリックIPアドレス
ServerAliveInterval 300
View dom_html_sanitizer.js
// inspired by http://code.google.com/p/google-caja/source/browse/trunk/src/com/google/caja/plugin/html-sanitizer.js
// instead of doing with text, only use DOM1 and DocumentFragment
var dom_html_sanitize;
(function(html4){
// usage is similar to html_sanitize method of html-sanitizer.js
// but takes an html document and returns a DocumentFragment
// @param document a document that the output DocumentFragment belongs to (must implement createDocumentFragment method)
// @param htmlDoc an html document to sanitize (must implement DOM1)
View BetterList.py
#!/usr/bin/python
class List(list):
def dup(self):
def _dup(lst,ancestors):
for orig,copy in ancestors:
if lst == orig:
return copy
copy = lst[:]
_ancestors = ancestors+[(lst,copy)]
for i,x in enumerate(copy):
@edvakf
edvakf / gist:8434738
Created Jan 15, 2014
PHP5.5で想定通りに動かなくなったコード
View gist:8434738
/**
* 想定する文字列(UCS2)かどうか
* (parse_strした結果に適用される)
*/
private static function isValidString($str)
{
if (mb_strlen($str, 'UTF-8') > self::MAX_DETAIL_CHAR_LENGTH) {
return false;
}
$ucs2 = mb_convert_encoding($str, 'UCS-2', 'UTF-8');
@edvakf
edvakf / PRML.R
Created Nov 26, 2013
PRML p152-p154
View PRML.R
# PRML p152-p154
library(ggplot2)
library(MASS)
# a0 and a1 are parameters to predict
a0 <- -0.3
a1 <- 0.5
f <- function(x) {a0 + a1 * x}
@edvakf
edvakf / nginx.conf
Last active Dec 27, 2015
isuconで使えそうなnginxのログ形式
View nginx.conf
log_format ltsv
"time:$time_iso8601"
"\treq_time:$request_time"
"\tapp_time:$upstream_response_time"
"\tres_size:$bytes_sent"
"\tstatus:$status"
"\tmethod:$request_method"
"\tpath:$request_uri"
"\thost:$remote_addr"
"\tua:$http_user_agent"
View 01.access.txt
sort by avg_time
avg total count method path
9.46 2753.95 291 GET /ticket/1
5.28 1510.27 286 GET /artist/1
4.54 1329.08 293 GET /
4.37 454.62 104 POST /buy
3.82 3.82 1 GET /admin/order.csv
1.22 2.45 2 POST /admin
0.15 0.15 1 GET /artist/2
0.03 4.28 130 GET /js/jquery-ui-1.8.24.custom.min.js
View gist:7289014
% brew install rbenv
Warning: rbenv-0.4.0 already installed
/Users/atsushi/prog/coursera/ex3-003/mlclass-ex3% brew install octave [master atsushi:~/prog/coursera/ex3-003/mlclass-ex3]
==> Installing dependencies for octave: gnu-sed, texinfo, fftw, readline, tbb, suite-sparse, glpk, libtool, jpeg, libpng, freetype, graphicsmagick, szip, hdf5, pcre, cmake, qhull, gmp, mpfr,
==> Installing octave dependency: gnu-sed
==> Downloading http://ftpmirror.gnu.org/sed/sed-4.2.2.tar.bz2
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/gnu-sed/4.2.2 --program-prefix=g
==> make install
==> Caveats
View gist:7264648
曲線フィッティング
オリジナル
http://jsfiddle.net/yBHac/1/
とりあえずJSをJSペインに分割
http://jsfiddle.net/SM2Kz/
You can’t perform that action at this time.