Skip to content

Instantly share code, notes, and snippets.

View AK-10's full-sized avatar

konishi.atsushi AK-10

View GitHub Profile
@AK-10
AK-10 / .vimrc
Created December 13, 2020 16:42
old vimrc
filetype plugin indent on
syntax on
" mapleader
let mapleader = ","
nnoremap <Leader>e :Explore<CR>
nnoremap <Leader>se :Sexplore<CR>
nnoremap <Leader>ve :Vexplore<CR>
set nocompatible
@AK-10
AK-10 / my_muon.vim
Created December 13, 2020 16:37
fav_color_schemes
"
"Maintainer: Greg Sexton <gregsexton@gmail.com>
"Last Change: 2012-08-04
"Version: 1.0
"URL: http://www.gregsexton.org/vim-color-schemes/muon/
set background=dark
if version > 580
"no guarantees for version 5.8 and below, but this makes it stop complaining
hi clear
@AK-10
AK-10 / fractional.swift
Created October 18, 2019 21:01
分数型
import Foundation
struct Fractional: CustomStringConvertible, Equatable {
let value: (Int, Int)
var num: Int {
return value.0
}
var den: Int {
@AK-10
AK-10 / redigo_example.go
Created August 16, 2019 02:52
redigoの利用例
func setSheetsToRedis(sheets []Sheet) {
conn, err := redis.Dial("tcp", "localhost:6379")
if err != nil {
panic(err)
}
defer conn.Close()
// primitive型以外はjson.Marshalする
serialized, _ := json.Marshal(sheets)
conn.Do("SET", sheetKey, serialized)
}
@AK-10
AK-10 / isucon_after_clone.md
Last active August 16, 2019 13:35
isuconプロジェクトクローンからの流れ

大まかな流れ

  • git clone プロジェクト
  • dep のインストール
    • go自体にpathが通っているか確認
    • 通っていなければexport PATH=$HOME/local/go/bin:$HOME/go/bin:$PATH <- これとは限らないので臨機応変に
    • go get -u github.com/golang/dep/cmd/dep
  • gopathの設定
    • export GOPATH=/path/to/{プロジェクト名}/webapp/go
import (
"errors"
"time"
"github.com/patrickmn/go-cache"
)
const (
messageNumPrefix = "MSG-NUM-"
)
# ARGV[0] : filepath
# ARGV[1] : kind (account | friends)
if ARGV.size < 2
puts "Error: argument num is not enough"
exit
end
path = ARGV[0]
kind = ARGV[1]
@AK-10
AK-10 / redis_template.go
Created July 20, 2019 07:44
isucon用redisテンプレート
package main
import (
"encoding/json"
"fmt"
"github.com/gomodule/redigo/redis"
)
// example
@AK-10
AK-10 / sorts
Created January 24, 2019 12:23
#include <stdio.h>
void swap(int *x, int *y)
{
int temp = *x;
*x = *y;
*y = temp;
}
void bubbleSort(int array[], int length)
import UIKit
import Foundation
class LinkedList<T: CustomStringConvertible> {
var head: Node<T>? = nil
class Node<T> {
var value: T