Skip to content

Instantly share code, notes, and snippets.

View orleika's full-sized avatar
🏠
Working from home

Koki Yasuda orleika

🏠
Working from home
View GitHub Profile
@orleika
orleika / index.html
Last active October 21, 2015 06:55
HTMLテンプレート
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<meta name="description" content="">
<meta property="og:type" content="">
<meta property="og:title" content="">
<meta property="og:description" content="">
<meta property="og:site_name" content="">
@orleika
orleika / getIP.js
Created January 25, 2015 13:47
Node.jsでの接続元IPアドレス取得
var getIP = function (req) {
if (req.headers['x-forwarded-for']) {
return req.headers['x-forwarded-for'];
}
if (req.connection && req.connection.remoteAddress) {
return req.connection.remoteAddress;
}
if (req.connection.socket && req.connection.socket.remoteAddress) {
return req.connection.socket.remoteAddress;
}
@orleika
orleika / projectEuler.js
Created February 2, 2015 09:41
paizaオンラインハッカソン4 Lite
process.stdin.resume();
process.stdin.setEncoding('utf8');
var input_lines = '';
var parseInt10 = function (v) {
return parseInt(v, 10);
}
process.stdin.on('data', function (chunk) {
<% extend 'layout' %>
<div class="wrapper">
<header role="banner">
<h1></h1>
</header>
<main role="main">
</main>
<footer role="contentinfo">
</footer>
</div>
@orleika
orleika / git_sshkey.md
Last active August 1, 2017 07:03
Git ssh key

Git ssh key

registration a ssh key with Github

Make ssh key

Answer yes to the all questions, and ~/.ssh/id_ed25519[.pub] are generated.

$ ssh-keygen -t ed25519 -C "[email protected]"

Register ssh key

@orleika
orleika / x509_cetificate.md
Last active August 1, 2017 07:06
How to make x.509 self-signed certificate

How to make x.509 self-signed certificate

# openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout myPrivateKey.key -out myCert.pem
# chmod 600 myPrivateKey.key
# openssl  x509 -outform der -in myCert.pem -out myCert.cer
myCert.cer
CER certificate
@orleika
orleika / template.cpp
Created February 13, 2015 14:35
プロコン用
#include <bits/stdc++.h>
#define dump(x) cerr << #x << "=" << (x) << endl
#define FOR(i, a, b) for(int i = int(a); i < int(b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define all(p) (p).begin(), (p).end()
#define rall(p) (p).rbegin(), (p).rend()
#define MP make_pair
#define PB push_back
@orleika
orleika / gist:c8f33b90cab712766550
Last active November 8, 2015 15:16
sendmail対策
Return-to-Address
X-PHP-Originating-Script
X-Authentication-Warning
SPF v=spf1 include:_spf.google.com ~all
@orleika
orleika / agm.js
Last active October 5, 2015 15:06
AGM Method
var pi = agm(3);
console.log(pi);
function agm(n) {
var a = 1,
b = 1 / Math.sqrt(2),
t = 1 / 4,
p = 1,
an;
for (var i = 0; i < n; i++) {
@orleika
orleika / oneline.sh
Last active November 15, 2015 08:51
Mongo oneline export
$ mongo --quiet dbname --eval 'db.collection.find();' > result.tsv