Skip to content

Instantly share code, notes, and snippets.

View gunyarakun's full-sized avatar

Tasuku SUENAGA a.k.a. gunyarakun gunyarakun

View GitHub Profile
@gunyarakun
gunyarakun / data.json
Created November 15, 2015 17:03
WAV to m4a (sample encoding DUO 3.0 cd)
{
"b": "320",
"artist": "鈴木 陽一",
"genre": "Books & Spoken",
"album": "DUO 3.0 復習用",
"year": 2000,
"cover-art": "DUO.jpg"
}
@gunyarakun
gunyarakun / add_compiler_flags_under_specific_condition_in_xcode_project_with_ruby.rb
Created October 7, 2015 03:30
Add compiler flags for specific files in Xcode project with Ruby
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
require 'xcodeproj'
# Add compiler flags to "Build Phases > Compile Sources"
def add_compiler_flags(xcproj, flags)
xcproj.targets.each do |target|
target.source_build_phase.files_references.each do |fileref|
# You can check fileref with fileref.path or fileref.parent
@gunyarakun
gunyarakun / README.md
Created June 3, 2015 08:03
Replace text nodes in HTML to HTML nodes
@gunyarakun
gunyarakun / invalid_macro_token.c
Last active August 29, 2015 14:21
invalid macro token: gcc NG Visual C++ OK
#include <stdio.h>
#define A(s) puts(s ## s);
int main(int argc, char *argv[]) {
A("a");
puts("a" "a");
return 0;
}
@gunyarakun
gunyarakun / CMakeLists.txt
Created May 25, 2015 00:05
Compile MacOSX Objective-C CLI program using NSBundle with CMake
PROJECT(hello)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMakeModules)
SET(PROJECT_BINARY_DIR build)
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
SET(CMAKE_C_FLAGS "-std=c99 -Wall")
IF(APPLE)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -framework Foundation")
@gunyarakun
gunyarakun / README.md
Last active September 26, 2022 18:21
旺文社『表現のための実践ロイヤル英文法』別冊付録「英作文のための暗記用例文300」JSON
@gunyarakun
gunyarakun / kriptos.rb
Created April 5, 2015 21:29
Kriptos solving script (K4 is not solved)
def decode_Vigenere(keyword, source)
s = 'KRYPTOSABCDEFGHIJLMNQUVWXZ'
t = []
keyword.each_char {|c|
i = s.index(c)
t << s[i..-1] + s[0...i]
}
r = []
d = 0
source.each_char.with_index {|c, i|
@gunyarakun
gunyarakun / craigslist.py
Created February 28, 2015 05:45
craigslist crawling and Slack notify
#!/usr/bin/env python
# encoding: utf-8
import json
import urllib
import urllib2
import codecs
import time
from bs4 import BeautifulSoup
token = 'xoxp-xxxxxxxx-xxxxxxxx-xxxxxxxx-xxxxxx'
@gunyarakun
gunyarakun / slackbot.py
Last active August 29, 2015 14:16
Simple Slack bot
#!/usr/bin/env python
# encoding: utf-8
import json
import urllib
import urllib2
token = 'xoxp-xxxxxxxx-xxxxxxxx-xxxxxxx-xxxxxx'
bot_name = 'gunyabot'
class SlackClient:
@gunyarakun
gunyarakun / dvd_copy.rb
Created October 23, 2014 01:33
Make DVD ISO image sequentially
#!/usr/bin/env ruby
require 'date'
HDD_PATH = '/Volumes/HFS_disks_from_japan/mushu_avs'
while true do
d = DateTime.now
status = `drutil status`
if status =~ /^\s+Type: [-A-Z]+\s+Name: (.+)$/