Skip to content

Instantly share code, notes, and snippets.

View nakamura-akifumi's full-sized avatar

Akifumi NAKAMURA nakamura-akifumi

  • Tochigi City, Tochigi Prefecture, JAPAN
  • X @tmpz84
View GitHub Profile
@nakamura-akifumi
nakamura-akifumi / nfctest.py
Created June 11, 2018 12:36
Felica CARD 接続確認サンプル
import nfc
clf=nfc.ContactlessFrontend()
clf.open('usb:001:006')
tag=clf.connect(rdwr={'on-connect': lambda tag: False})
print(tag)
import sys
from PyQt5.QtWidgets import QApplication, QWidget, QPushButton
if __name__ == '__main__':
app = QApplication(sys.argv)
window = QWidget()
button = QPushButton('button', window)
window.show()
@nakamura-akifumi
nakamura-akifumi / gist:cf96ec8125d0b1402508a6bb01d3b29c
Last active June 12, 2018 12:46
install memo qt quick on raspberry pi 3 (Raspbian 2018-04-18-raspbian-stretch.img)
# 無線LANの設定
# GL Driver Enable G1 GL (Full KMS)
# see also: https://stackoverflow.com/questions/47899501/raspbian-qml-bad-performance
$ sudo raspi-config
$ wget https://gist.githubusercontent.com/nakamura-akifumi/0dc211c1b8a02e5b526083803b4f0393/raw/a8c29dd9f7cb6100ae76de304ad20962975950fb/config.txt
$ sudo cp config.txt /boot
$ sudo apt-get -y update
$ sudo apt-get -y upgrade
@nakamura-akifumi
nakamura-akifumi / config.txt
Created June 4, 2018 12:47
Raspberry-pi Display Config (/boot/config.txt)
# For more options and information see
# http://rpf.io/configtxt
# Some settings may impact device functionality. See link above for details
# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1
# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
#disable_overscan=1
@nakamura-akifumi
nakamura-akifumi / gist:af542f83f3fe7b2ec2ae
Created April 8, 2015 08:45
非同期ダウンロードのサンプル
<script>
var xhr = new XMLHttpRequest();
$(function () {
$('#submitbutton').click(function() {
//var xhr = new XMLHttpRequest();
xhr.open('GET', 'http://www.tmpz84.info:3000/large-file.iso', true);
xhr.responseType = 'blob';
xhr.onload = function () {
if (this.status === 200) {
var blob = this.response;
@nakamura-akifumi
nakamura-akifumi / gist:c298201d0701c5afb421
Created March 12, 2015 03:24
自分のIPアドレスをslackに投げるphpスクリプト
<?php
$incomingUrl = ''; // 発行されたURL
$payload = array(
'text' => GetMyHostname().'のアドレス:'.GetMyIpAddr(),
'username' => 'tmpz84',
// 'icon_url' => 'https://slack.global.ssl.fastly.net/12078/img/services/incoming-webhook_48.png',
'icon_emoji' => ':beginner:',
'channel' => '#server_status',
@nakamura-akifumi
nakamura-akifumi / gist:ab809e4837ad18613557
Last active August 29, 2015 14:14
nginx default.conf
upstream app_server {
server unix:/tmp/unicorn_${appname}.sock fail_timeout=0;
# for TCP setups, point these to your backend servers
#server localhost:3000 fail_timeout=0;
}
server {
listen 80;
server_name ${hostname};
@nakamura-akifumi
nakamura-akifumi / gist:e0a28d24e27cd3883efa
Created February 3, 2015 05:10
アプリの設定(nginx)
mkdir -p /opt/app
chown misadmin:misadmin /opt/app
cd /etc/nginx/conf.d
cp default.conf default.conf.org
@nakamura-akifumi
nakamura-akifumi / gist:c0a0e749e73483fe7574
Last active August 29, 2015 14:14
iptablesの設定
iptables -A INPUT -p tcp --tcp-flags ALL NONE -j DROP
iptables -A INPUT -p tcp ! --syn -m state --state NEW -j DROP
iptables -A INPUT -p tcp --tcp-flags ALL ALL -j DROP
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -p icmp -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
# iptables -A INPUT -p tcp -m tcp --dport 443 -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 10037 -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 10083 -j ACCEPT
iptables -I INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
@nakamura-akifumi
nakamura-akifumi / gist:5a810c5cb2a6191181ee
Last active August 29, 2015 14:14
nginx と zabbixインストール
echo "start script"
echo "step 1: install nginx"
cat << 'EOL' >> /etc/yum.repos.d/nginx.repo
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1