Skip to content

Instantly share code, notes, and snippets.

@azhawkes
azhawkes / SnakeCaseApplicationConfiguration.java
Created October 15, 2015 15:32
Spring Boot: convert inbound parameters from snake_case to camelCase
@Configuration
public class SnakeCaseApplicationConfiguration {
@Bean
public OncePerRequestFilter snakeCaseConverterFilter() {
return new OncePerRequestFilter() {
@Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException {
final Map<String, String[]> parameters = new ConcurrentHashMap<>();
for (String param : request.getParameterMap().keySet()) {
@YoshihitoAso
YoshihitoAso / gist:9048005
Last active December 18, 2018 05:30
[Python][Mecab]ubuntu環境にmecabをインストールする方法

Ubuntu環境にMecabをインストールする方法

インストール手順

$ sudo apt-get install mecab libmecab-dev mecab-ipadic
$ sudo aptitude install mecab-ipadic-utf8
$ sudo apt-get install python-mecab

SAMPLE

@tomykaira
tomykaira / markdown-to-hiki.rb
Created March 2, 2012 08:50
Convert markdown to hiki / markdown テキストから hiki 形式に変換するスクリプト(適当)
# -*- coding: utf-8 -*-
ARGV.each do |fn|
lines = File.readlines(fn)
hiki = lines.map { |l|
l.sub(/^(#+)\s/){ '!'*($1.length) + ' ' }.
sub(/^(-+)\s/){ '*'*($1.length) + ' ' }.
gsub(/\!\[([^\]]+)\]\(([^\)]+)\)/){ $2[0..3] == 'http' ? $2 : ('http://goos-lokka.heroku.com' + $2) }. # picture
gsub(/\[([^\]]+)\]\(([^\)]+)\)/, '[[\1|\2]]'). # url
gsub(/\*\*([^*]*)\*\*/, "'''\\1'''").
sub(/^ /, ' ').
@yono
yono / extractword.py
Created January 8, 2010 04:52
MeCabの出力結果を基に接頭辞や接尾辞を連結する -> http://github.com/yono/py-extractword
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import re
import MeCab
class Word(object):
def __init__(self,surface,feature):
self.surface = surface
self.feature = feature