Skip to content

Instantly share code, notes, and snippets.

View curipha's full-sized avatar
🕊️
Pray for peace

OKAMOTO Taichi curipha

🕊️
Pray for peace
  • Kyoto, Japan
  • 13:46 (UTC +09:00)
View GitHub Profile
@curipha
curipha / mecab.cpp
Last active May 4, 2021 04:40
C++ source to use Mecab library
// Run following command to build this file.
// $ g++ `mecab-config --cflags` `mecab-config --libs` -Os mecab.cpp
#include <iostream>
#include <mecab.h>
int main (int argc, char **argv) {
const MeCab::Node* node = MeCab::createTagger("")->parseToNode("隣の客はよく柿食う客だ。");
for (; node; node = node->next) {
switch(node->stat) {
@curipha
curipha / mecab.rb
Last active May 7, 2017 06:28
Ruby script to use Mecab via natto gem
#!/usr/bin/env ruby
require 'natto'
require 'pp'
nm = Natto::MeCab.new
morph = []
while line = $stdin.gets
nm.parse(line) {|n|
next unless n.is_nor? || n.is_unk?
@curipha
curipha / zsh_history_merge.rb
Last active June 19, 2022 12:46
History merge tool for zsh
#!/usr/bin/env ruby -E BINARY
# The original script was published in zsh thread@2ch.net and is licensed under the public domain.
history = []
l = nil
while l = gets
while /\\\Z/ === l
l << gets
@curipha
curipha / start_conky.sh
Last active May 7, 2017 06:33
Conky startup script (Wait until X is initialized. "12sec." is a magic!)
#!/usr/bin/env bash
sleep 12 && conky
@curipha
curipha / ubuntu_fontmodify.sh
Created May 7, 2017 06:32
Font modifier script for Ubuntu 11.10 w/ Unity (UbuntuTweak can also modify these font settings)
#!/usr/bin/env bash
gsettings set org.gnome.desktop.interface font-name 'MigMix 2P 10'
gsettings set org.gnome.desktop.interface document-font-name 'MigMix 2P 10'
gsettings set org.gnome.desktop.interface monospace-font-name 'MigMix 2M 10'
gconftool-2 --type string --set /apps/metacity/general/titlebar_font "MigMix 2P Bold 10"
@curipha
curipha / debug_modal.sap
Created May 7, 2017 06:44
Run debugger for SAP modal window (Drag and drop this file to SAP window)
[Function]
Command=/H
Title=Debugger
Type=SystemCommand
@curipha
curipha / quitall_sap.vbs
Created May 7, 2017 06:45
Close all SAP session
' ___ _ ___ ___ _ _ ___
' / __| /_\ | _ \ / __| | | |_ _|
' \__ \/ _ \| _/ | (_ | |_| || |
' |___/_/ \_\_| \___|\___/|___|
' Automation
Option Explicit
Dim SapGui, Application, Connection
@curipha
curipha / fqdn_sort.rb
Created May 23, 2017 12:14
Sort the list of FQDN (e.g. www.example.com)
#!/usr/bin/env ruby
fqdn = []
while STDIN.gets
fqdn << $_.strip
end
def s(l)
return l.split('.').reverse.join('.')
end
@curipha
curipha / mass_dns_check.rb
Created May 23, 2017 12:17
Check the FQDN is valid and resolvable
#!/usr/bin/env ruby
# Google Public DNS
#DNS = %w( 8.8.8.8 8.8.4.4 )
# (Recommended) Google Public DNS, Dnsadvantage, OpenDNS, NortonDNS, Level 3
DNS = %w( 8.8.8.8 8.8.4.4 156.154.70.1 156.154.71.1 208.67.222.222 208.67.220.220 198.153.192.1 198.153.194.1 4.2.2.1 4.2.2.2 4.2.2.3 4.2.2.4 4.2.2.5 4.2.2.6 )
WAITMAX = 5000 # ms
@curipha
curipha / port_scanner.rb
Created May 23, 2017 12:19
Simple port scanner written in Ruby
#!/usr/bin/env ruby
require 'socket'
require 'timeout'
require 'thread'
$stdout.sync = true
DEBUG = false # Debug mode