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 / 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 / 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 / README.md
Last active September 26, 2022 18:21
旺文社『表現のための実践ロイヤル英文法』別冊付録「英作文のための暗記用例文300」JSON
@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 / 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 / README.md
Created June 3, 2015 08:03
Replace text nodes in HTML to HTML nodes
@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 / 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 / comment_to_lyric.py
Created November 15, 2015 17:36
m4a comment to lyric
#!/usr/bin/env python
import os
import sys
from mutagen.mp4 import MP4
def find_all_files(directory, ext):
for root, dirs, files in os.walk(directory):
for file in files:
if file.lower().endswith('.' + ext):
yield os.path.join(root, file)
@gunyarakun
gunyarakun / idx_offset_change.rb
Last active December 30, 2015 18:39
.idx/.sub形式の字幕のオフセット時間をずらすスクリプト
#!/usr/bin/env ruby
if ARGV.length != 4
puts "#{$PROGRAM_NAME} in.idx out.idx secdiff ratio"
puts "ex.) #{$PROGRAM_NAME} in.idx out.idx 15.34 1.01"
exit(1)
end
in_path, out_path, time_diff, ratio = ARGV
time_diff = time_diff.to_f * 1000