This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env perl | |
| use strict; | |
| use warnings; | |
| use feature qw(say); | |
| use Encode; | |
| use PDF::API2; | |
| my $pdf = PDF::API2->open($ARGV[0]) or die; | |
| for my $p (1 .. $pdf->pages) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package Plagger::Plugin::CustomFeed::Config; | |
| use strict; | |
| use base qw( Plagger::Plugin ); | |
| use DirHandle; | |
| use Encode; | |
| use File::Spec; | |
| use List::Util qw(first); | |
| use Plagger::Date; # for metadata in plugins | |
| use Plagger::Util qw( decode_content ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| From de5e8c5038751a105a089b030716c883d8842758 Mon Sep 17 00:00:00 2001 | |
| From: emasaka <emasaka@gmail.com> | |
| Date: Fri, 30 Sep 2011 20:46:49 +0900 | |
| Subject: [PATCH 1/2] expand t.co | |
| --- | |
| lib/earthquake/output.rb | 15 ++++++++++++++- | |
| 1 files changed, 14 insertions(+), 1 deletions(-) | |
| diff --git a/lib/earthquake/output.rb b/lib/earthquake/output.rb |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff -up ruby-1.9.2-p290/ruby.c filter-ruby-1.9.2-p290/ruby.c | |
| --- ruby-1.9.2-p290/ruby.c 2010-12-23 19:49:13.000000000 +0900 | |
| +++ filter-ruby-1.9.2-p290/ruby.c 2011-10-28 21:50:44.452623054 +0900 | |
| @@ -1618,7 +1618,16 @@ load_file_internal(VALUE arg) | |
| return (VALUE)rb_parser_compile_string(parser, fname, f, line_start); | |
| } | |
| rb_funcall(f, set_encoding, 2, rb_enc_from_encoding(enc), rb_str_new_cstr("-")); | |
| - tree = rb_parser_compile_file(parser, fname, f, line_start); | |
| + { | |
| + VALUE source_filter = rb_intern("source_filter"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| udisks --monitor | while read ev; do | |
| if [[ "$ev" == changed:* ]]; then | |
| dev=${ev##*/} | |
| if [[ "$dev" == *_* ]]; then | |
| dev=$(echo -e ${dev//_/\\x}) # "_2d" -> "-" | |
| fi | |
| mp=$(udisks --show-info "/dev/$dev" | sed -n '/^ mount paths: */{s///;p}') | |
| if [ -n "$mp" ]; then | |
| notify-send mounted "$dev -> $mp" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (defvar marusuji-ary ["⓪" "①" "②" "③" "④" "⑤" "⑥" "⑦" "⑧" "⑨" | |
| "⑩" "⑪" "⑫" "⑬" "⑭" "⑮" "⑯" "⑰" "⑱" "⑲" | |
| "⑳" "㉑" "㉒" "㉓" "㉔" "㉕" "㉖" "㉗" "㉘" "㉙" | |
| "㉚" "㉛" "㉜" "㉝" "㉞" "㉟" "㊱" "㊲" "㊳" "㊴" | |
| "㊵" "㊶" "㊷" "㊸" "㊹" "㊺" "㊻" "㊼" "㊽" "㊾" "㊿" ]) | |
| (defun region-to-marusuji (beg end) | |
| (interactive "r") | |
| (let ((n (string-to-int (buffer-substring beg end)))) | |
| (when (and (<= 0 n) (<= n 50)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby | |
| require 'nokogiri' | |
| require 'open-uri' | |
| def scrape | |
| html = open('http://forkwell.com/') {|io| io.read } | |
| Nokogiri::HTML(html, 'utf-8').css('div.grid-unit').map do |sect| | |
| title = sect.css('header h1 a')[0]['alt'] | |
| items = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (require 'hi-lock) | |
| (defun grepf->regexp (file) | |
| (with-temp-buffer | |
| (insert-file-contents file) | |
| (goto-char (point-max)) | |
| (when (looking-back "\n") | |
| (delete-char -1) ) | |
| (goto-char (point-min)) | |
| (while (search-forward "\n" nil t) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # answer of http://d.hatena.ne.jp/Yamashiro0217/20120727/1343371036 | |
| ## q1 | |
| cat log.txt | |
| ## q2 | |
| cut -d , -f 1,4 log.txt | |
| ## q3 | |
| grep ^server4 log.txt | |
| ## q4 | |
| wc -l < log.txt | |
| ## q5 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| get_col() { | |
| local str=$1 fs=$2 keycol=$3 | |
| local -a a | |
| IFS=$fs a=($str) | |
| echo ${a[$keycol]} | |
| } | |
| cmp_str() { [[ $1 < $2 ]]; } |