Skip to content

Instantly share code, notes, and snippets.

arton arton

Block or report user

Report or block arton

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View pdf_firstpage.rb
require 'origami'
pdf = Origami::PDF.read(ARGV[0], verbosity: Origami::Parser::VERBOSE_QUIET)
unless pdf.pages.first.Resources.Font.C2_0
exit 1
end
font_table = {}
pdf.pages.first.Resources.each_font do |name, font|
puts name if $DEBUG
@arton
arton / binsearch.coffee
Last active Aug 4, 2018
binary search for Coffee
View binsearch.coffee
binsearch = (a, low, high, target) ->
if low == high || low + 1 == high
if a[low] < target then return low + 1 else return low
mid = Math.floor((low + high) / 2)
if a[mid] == target
return mid
else if target > a[mid]
binsearch(a, mid + 1, high, target)
else
binsearch(a, low, mid - 1, target)
View gist:3712ca25c745de8e45d877b78543813f
Windows 2012 R2のHyper-V用NAT
New-VMSwitch -SwitchName "Hyper-V-Switch" - SwitchType Internal
Get-NetIPAddress -InterfaceAlias "vEthernet (Hyper-V-Switch)"
IPAddress : 169.254.141.105 ……… 適当なものが振られる
InterfaceIndex : n ………………… 後で使う
InterfaceAlias : vEthernet (Hyper-V-Switch)
AddressFamily : IPv4
View gist:b50eeaf0be5b04527b9937eea22f9a63
c:\Users\arton\Documents\ruby\2.4.0-p>nmake test
Microsoft(R) Program Maintenance Utility Version 12.00.21005.1
Copyright (C) Microsoft Corporation. All rights reserved.
CC = cl -nologo
LD = cl -nologo
LDSHARED = cl -nologo -LD
CFLAGS = -MD -Zi -W2 -wd4100 -wd4127 -wd4210 -wd4214 -wd4255 -wd4574 -wd4668 -wd4710 -wd4711 -wd4820 -wd4996 -we4028 -we4142 -O2sy- -Zm600
XCFLAGS = -DRUBY_EXPORT -I. -I.ext/include/i386-mswin32_120 -I../ruby-2.4.0-preview1/include -I../ruby-2.4.0-preview1 -I../ruby-2.4.0-preview1/missing
View gist:8251566
=begin
Copyright(c) 2008 arton
Usage of the works is permitted provided that this instrument is retained
with the works, so that any entity that uses the works is notified of this
instrument.
DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
@arton
arton / grep.bat
Last active Dec 16, 2015
Grep for CP932, utf-8 and utf-16 as batch file
View grep.bat
@echo off
c:\progra~2\RUBY-2~1.0\bin\ruby -x "%~f0" %*
@goto endofruby
#!C:/PROGRA~2/RUBY-2~1.0/bin/ruby
# coding: utf-8
if ARGV.size < 2
exit 1
end
def find_pattern(fn, enc, pattern)
View diffcp
#!/Users/local/bin/ruby
# coding: utf-8
require 'fileutils'
$user = 'user'
$pwd = 'pwd'
$server = 'nas-hostname'
module MusicBackup
def self.to_path(d, f)
@arton
arton / gist:2429713
Created Apr 20, 2012
Using Kuromoji with RJB
View gist:2429713
#coding: utf-8
require 'rjb'
module JavaIterator
def each
i = self.iterator
while i.has_next
yield i.next
end
end
end
@arton
arton / gist:4250656
Created Dec 10, 2012
ennoumu.rb (single thread version)
View gist:4250656
# coding: utf-8
require "rbconfig"
require_relative './ennou.rb'
module Rack
module Handler
class Ennoumu < Ennou
@arton
arton / sound.patch
Created Oct 13, 2012
DXRuby-1.4.0パッチ
View sound.patch
--- sound.c~ Sun Apr 15 21:46:08 2012
+++ sound.c Sat Oct 13 17:43:16 2012
@@ -1,4 +1,5 @@
#define WINVER 0x0500 /* バージョン定義 Windows2000以上 */
+#define DIRECTSOUND_VERSION 0x0900
#define _WIN32_WINNT WINVER
#include "ruby.h"
You can’t perform that action at this time.