Skip to content

Instantly share code, notes, and snippets.

View komasaru's full-sized avatar

mk-mode komasaru

View GitHub Profile
@komasaru
komasaru / SjistToUtf8.cpp
Created August 6, 2014 04:54
Gist - C++ source code to convert ShiftJIS to UTR-8.
/***********************************************************
* 文字コード変換 (ShiftJIS -> UTF-8)
**********************************************************/
#include <fstream>
#include <iostream> // for cout, endl
#include <stdio.h> // for fopen
#include <string.h> // for strlen
#include <iconv.h> // for iconv
#define ENC_SRC "Shift_JIS" // Encoding ( Src )
@komasaru
komasaru / BoostRegexI.cpp
Created August 14, 2014 07:08
C++ source code to match regular expressions using iterators by boost.
/*
* Matching regular expressions using iterators by boost.
*/
#include <iostream>
#include <string>
#include <boost/regex.hpp> // require "boost-regex-dev"
using namespace std;
/*
@komasaru
komasaru / BoostRegexW.cpp
Last active August 29, 2015 14:05
C++ source code to match regular expressions(wchar) by boost.
/*
* Matching regular expressions by boost. (for wchar)
*/
#include <iostream>
#include <string>
#include <boost/regex.hpp> // require "boost-regex-dev"
using namespace std;
/*
@komasaru
komasaru / BoostRegexR.cpp
Created August 14, 2014 07:15
C++ source code to replace regular expressions by boost.
/*
* Replacement of regular expressions by boost.
*/
#include <iostream>
#include <string>
#include <boost/regex.hpp> // require "boost-regex-dev"
using namespace std;
/*
@komasaru
komasaru / CntStrUtf8.cpp
Created September 2, 2014 03:30
C++ source code to count strings of UTF-8.
#include <iostream>
#include <string.h>
using namespace std;
/*
* [CLASS] Proc
*/
class Proc
{
@komasaru
komasaru / geo_ruby.rb
Last active August 29, 2015 14:06
Ruby to read a shapefile with georuby.
#*********************************************
# Ruby script to read shapefile.
#*********************************************
#
require 'geo_ruby'
require 'geo_ruby/shp4r/shp'
include GeoRuby::Shp4r
include GeoRuby::SimpleFeatures
@komasaru
komasaru / YamlCpp.cpp
Created September 27, 2014 04:08
C++ source code to get yaml informations by yaml-cpp.
/**
* Get yaml informations by yaml-cpp.
*/
#include "string"
#include "yaml-cpp/yaml.h"
using namespace std;
int main(int argc, char* argv[]){
try{
@komasaru
komasaru / check_html.sh
Created October 20, 2014 03:03
Bash script to check a difference between a saved-html and a current-html.
#!/bin/bash
# 定数定義
URL="http://www.foo.xxx/bar/baz/" # チェックした Web サイトの URL
FILE_S="/path/to/saved.html" # 前回取得 HTML のファイル
FILE_C="/path/to/current.html" # 今回取得 HTML のファイル
# 当スクリプトの存在ディレクトリへ移動
cd /path/to/
@komasaru
komasaru / YamlCpp03.cpp
Created November 11, 2014 07:44
C++ source code to get yaml informations by yaml-cpp 0.3 series.
/*
* Getting yaml informations by yaml-cpp 0.3 series.
*/
#include <fstream>
#include <string>
#include "yaml-cpp/yaml.h"
using namespace std;
struct Db {
@komasaru
komasaru / japan_standard.R
Created November 25, 2014 07:44
R scirpt to draw a map of Japan. (Standard Ver.)
# ----------------------------------------
# R scirpt to draw a map of Japan. (Standard Ver.)
# ----------------------------------------
# ライブラリの読み込み
library(gpclib)
library(ggplot2)
library(maptools)
# ----------------------------------------
print("**** 各種設定")