Skip to content

Instantly share code, notes, and snippets.

View nnsnodnb's full-sized avatar
🌻
お花のように清く正しく美しく生きたい

Yuya Oka nnsnodnb

🌻
お花のように清く正しく美しく生きたい
View GitHub Profile
@nnsnodnb
nnsnodnb / windows_use_ls_command.md
Created August 26, 2015 18:39
Windowsで「ls」コマンドを使う方法

常時lsコマンドを使う場合

  1. テキストエディタに以下を書き込み保存.
dir %1

ファイル名は「ls.bat」とする.
この時ファイルの種類を「すべてのファイル(*.*)」にしておく.

@nnsnodnb
nnsnodnb / checker_php_mysql.php
Last active August 29, 2015 14:26
PHPでMySQLとの接続テスト簡単コード
<?php
$dsn = 'mysql:dbname=mysql;host=127.0.0.1';
$user = 'root';
$password = 'PASSWORD';
$dbh = new PDO($dsn, $user, $password);
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sql = "SELECT COUNT(*) as cnt FROM user";
foreach ($dbh->query($sql) as $row)
@nnsnodnb
nnsnodnb / calender.html
Last active August 31, 2015 18:27
jQueryを使って,<input type="date">に対応していないブラウザにカレンダーをフォームに表示させる
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<title></title>
<!-- jQuery -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<!-- jQueryUI -->
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1/i18n/jquery.ui.datepicker-ja.min.js"></script>
@nnsnodnb
nnsnodnb / stream.py
Last active February 18, 2016 10:49
ToDoアプリにツイートからタスクを追加
#!/usr/bin/env python3
# coding: utf-8
from tweepy.streaming import StreamListener, Stream
from tweepy.auth import OAuthHandler
from tweepy.api import API
from datetime import timedelta
import os
import mysql.connector
@nnsnodnb
nnsnodnb / install_mergepbx.sh
Created April 18, 2016 09:46 — forked from kaneshin/install_mergepbx.sh
To install mergepbx. This script is under the MIT License.
#!/bin/sh
MERGEPBX_TARGET=mergepbx
MERGEPBX_PREFIX=/usr/local/bin
MERGEPBX_BUILD_DIR=/tmp
MERGEPBX_REPO=https://github.com/simonwagner/mergepbx.git
build()
{
cd $MERGEPBX_BUILD_DIR/$MERGEPBX_TARGET
@nnsnodnb
nnsnodnb / .gitignore
Created August 18, 2016 01:08
Xcode project's .gitignore
### Xcode ###
# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
## Build generated
build/
DerivedData/
## Various settings
from bottle import route, run, HTTPResponse
@route('<url:path>')
def callback(url):
body = 'ただいまアクセスが集中しているため、サイトが繋がりづらい状態になっています。 ご迷惑をおかけして申し訳ありません。'
r = HTTPResponse(status=503, body=body)
r.set_header('Content-Type', 'document')
return r
if __name__ == '__main__':
@nnsnodnb
nnsnodnb / python_django_osx_virtualenv_pycharm
Last active February 24, 2017 01:25
オレオレPython環境 .gitignoreだゾイ
### Django ###
*.log
*.pot
*.pyc
__pycache__/
local_settings.py
db.sqlite3
media
staticfiles/
@nnsnodnb
nnsnodnb / push.js
Last active June 21, 2017 20:19
Apple Push Notification Service Sample codes
var http = require('http');
var server = http.createServer();
var apns = require('apn');
var options = {
cert: './cert.pem',
key: './key.pem',
gateway: 'gateway.sandbox.push.apple.com',
port: 2195,
};
@nnsnodnb
nnsnodnb / api_client.py
Created January 24, 2018 07:37
特定のツイートのRTした人を取得してランダムで抽出するソレ
# coding: utf-8
from requests_oauthlib import OAuth1Session, OAuth1
import requests
import settings
class APIClient(object):