Skip to content

Instantly share code, notes, and snippets.

View Code-Hex's full-sized avatar
:shipit:
Go Travel

Kei Kamikawa Code-Hex

:shipit:
Go Travel
View GitHub Profile
@Code-Hex
Code-Hex / UnivFeliCa.md
Created December 5, 2016 07:30 — forked from oboenikui/UnivFeliCa.md
大学生協FeliCaの仕様

WHAT IS THIS

大学生協のFeliCa,及び諸大学の学生証一体型FeliCaの仕様
レスポンスについては,特に表記のない限り東北大学のもの (学生証一体型ではない)
断りのない限りコードはビッグエンディアンで通信する (下記のドキュメントに合わせた)
記号と区別するため,アルファベットの大文字表記は記号,小文字表記は16進表記とする

FeliCa自体の仕様については,Sony公式のドキュメントを参考に

System Code

@Code-Hex
Code-Hex / modified-format.go
Last active October 19, 2016 08:04
Last-Modified, If-Modified-Since
func ModifiedFormat() string {
t := time.Now()
return fmt.Sprintf("%s, %02d %s %d %02d:%02d:%02d GMT",
t.Weekday().String()[:3],
t.Day(),
t.Month().String()[:3],
t.Year(),
t.Hour(),
t.Minute(),
t.Second())
@Code-Hex
Code-Hex / micd.go
Created July 2, 2016 14:01
migemo を使ったディレクトリ候補
package main
import (
"errors"
"fmt"
"io/ioutil"
"os"
"os/user"
"path/filepath"
"strings"
@Code-Hex
Code-Hex / erros.go
Created June 25, 2016 02:05
golang Errors
package main
import (
"fmt"
"io"
"os"
"github.com/pkg/errors"
)
@Code-Hex
Code-Hex / download.go
Created June 25, 2016 00:54
分散ダウンローダー with go
package main
import (
"fmt"
"io"
"net/http"
"os"
"runtime"
"strconv"
"strings"
@Code-Hex
Code-Hex / semi.swift
Last active June 18, 2016 00:43
SemiEncode, SemiDecode
import Foundation
extension String {
var binary: String {
let chars = self.characters.map { String($0).unicodeScalars.first!.value }
return chars.map({ String($0, radix: 2).pad(24) }).joinWithSeparator("")
}
func bintostr() -> String {
@Code-Hex
Code-Hex / ngram.pl
Created May 26, 2016 05:43
マルコフ連鎖 Ngram 辞書作成
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
use Encode qw/encode_utf8 decode_utf8/;
use v5.10;
use Data::Dumper;
use Text::MeCab;
my $mt = Text::MeCab->new(dicdir => "/usr/local/lib/mecab/dic/mecab-ipadic-neologd");
@Code-Hex
Code-Hex / mergesort.cpp
Last active July 22, 2017 07:21
マージソート(通常)
#include <iostream>
#include <algorithm>
#include <vector>
#include <pthread.h>
using namespace std;
void mergesort(vector<int> &n, int i)
{
@Code-Hex
Code-Hex / oauth.pl
Last active May 10, 2016 10:36
sample
sub github_auth {
my $self = shift;
my $config = $self->config->{github}->{user};
# login してない場合
unless ($self->is_login) {
# error 処理
if (my $error = $self->param('error')) {
return $self->render(
text => "Call to github returned: $error"
);
@Code-Hex
Code-Hex / knapsack.cpp
Last active July 23, 2019 18:03
Knapsack problem with cpp
#include <iostream>
#include <bitset>
#include <algorithm>
#include <string>
#include <math.h>
#include <string.h>
#include <pthread.h>
#define N 8