Skip to content

Instantly share code, notes, and snippets.

SHIDA Yuuma macrat

Block or report user

Report or block macrat

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
@macrat
macrat / snippets.ps1
Last active Dec 26, 2018
powershellのスニペット集的なものを作りつつある。
View snippets.ps1
<#
.SYNOPSIS
A snippets for powershell scripting.
.NOTE
It's WIP.
#>
<#
@macrat
macrat / fssql.py
Created Dec 6, 2018
SQL上にファイルシステム的なもの
View fssql.py
import hashlib
import pathlib
import sqlite3
class Tree:
def __init__(self, db, tag):
self.db = db
self.tag = tag
@macrat
macrat / TarFileSystem.go
Created Dec 5, 2018
go言語でtarアーカイブをファイルシステムっぽく扱うやつ。作りかけ。
View TarFileSystem.go
package main
import (
"archive/tar"
"io"
"os"
"path/filepath"
"gopkg.in/src-d/go-billy.v4"
"gopkg.in/src-d/go-billy.v4/osfs"
@macrat
macrat / nyaan.py
Created Aug 14, 2018
にゃーん信号
View nyaan.py
# http://neocat.hatenablog.com/entry/20120917/1347902845
class Nyaan:
table = {'A':'にゃんにゃーん', 'B':'にゃーんにゃんにゃんにゃん', 'C':'にゃーんにゃんにゃーんにゃん', 'D':'にゃーんにゃんにゃん',
'E':'にゃん', 'F':'にゃんにゃんにゃーんにゃん', 'G':'にゃーんにゃーんにゃん', 'H':'にゃんにゃんにゃんにゃん',
'にゃーん':'にゃんにゃん', 'J':'にゃんにゃーんにゃーんにゃーん', 'K':'にゃーんにゃんにゃーん', 'L':'にゃんにゃーんにゃんにゃん',
'M':'にゃーんにゃーん', 'N':'にゃーんにゃん', 'O':'にゃーんにゃーんにゃーん', 'P':'にゃんにゃーんにゃーんにゃん',
'Q':'にゃーんにゃーんにゃんにゃーん', 'R':'にゃんにゃーんにゃん', 'S':'にゃんにゃんにゃん', 'T':'にゃーん',
'U':'にゃんにゃんにゃーん', 'V':'にゃんにゃんにゃんにゃーん', 'W':'にゃんにゃーんにゃーん', 'X':'にゃーんにゃんにゃんにゃーん',
'Y':'にゃーんにゃんにゃーんにゃーん', 'Z':'にゃーんにゃーんにゃんにゃん',
@macrat
macrat / pam_login.c
Created May 28, 2018
C言語でPAMを使ってログイン認証
View pam_login.c
#include <security/pam_appl.h>
#include <security/pam_misc.h>
#include <stdio.h>
#include <string.h>
#define USERNAME "this is username"
#define PASSWORD "this is password"
static int conv_func(int num_msg, const struct pam_message **msg, struct pam_response **resp, void *appdata_ptr) {
@macrat
macrat / tic-tac-toe.py
Created May 20, 2018
chainerでマルバツゲーム。失敗作。
View tic-tac-toe.py
import numpy
import chainer
import chainer.links as L
import chainer.functions as F
def judge(board):
"""
>>> judge(numpy.array([[ 1, 1, 1],
... [.5, 0, .5],
@macrat
macrat / dice-count.py
Created Mar 12, 2018
Python/OpenCVで特徴点マッチングして、DBSCANでクラスタリングしたらサイコロの目の合計とか出せないかと思ったやつ。失敗。
View dice-count.py
import os
import cv2
import numpy
import matplotlib.pyplot as plt
from sklearn.cluster import DBSCAN
images = [cv2.imread('dataset/samples/' + x) for x in os.listdir('dataset/samples') if x.endswith('.jpg')] # サイコロの特定の面の教師画像
original = cv2.imread('dataset/random/0.jpg') # ランダムにサイコロを転がした画像
View newdown.html
<!doctype html>
<title>new blankdown design</title>
<meta name=viewport content="width=device-width,initial-scale=1">
<body>
<nav>
<div id=nav-inner>
<textarea id=search-box cols=1 placeholder="search"></textarea>
<ul id=tag-area>
@macrat
macrat / face_finder.py
Created Feb 6, 2018
顔を見付けたら通知するシステム
View face_finder.py
import base64
import cv2
import numpy
import sendgrid
SENDGRID_APIKEY = 'your API key here'
TO_ADDRESS = 'mail-to@example.com'
FROM_ADDRESS = 'mail-from@example.com'
@macrat
macrat / markdown-with-simplexer.go
Created Jan 10, 2018
simplexerでMarkdownをHTMLに変換する実験
View markdown-with-simplexer.go
package main
import (
"fmt"
"os"
"github.com/macrat/simplexer"
)
const (
You can’t perform that action at this time.