Skip to content

Instantly share code, notes, and snippets.

@osamu2001
osamu2001 / amacsv2scrapbox.php
Created November 9, 2021 11:37
kindle マンガ本棚の一覧CSVをいい感じにscrapboxに変換する
<?php
# ref https://gist.github.com/furyutei/f7e407fe4b83fd45ef5efbd64ae1a70e
$file = new SplFileObject($argv[1]);
$file->setFlags(SplFileObject::READ_CSV);
$arr = [];
$pages = [];
foreach ($file as $row){
$page = [];
<?php
function rowToString(array $row)
{
$amzn = '[link http://amazon.jp/dp/' . $row[0] . ']';
$title = str_replace('[',' ',str_replace(']',' ',$row[1]));
$author = $row[2];
$d = strtotime($row[3]);
$ym = date('Y-m',$d);
$ymd = date('Y-m-d',$d);
$v = " [" . $title . "] $amzn [" . $author . "]";
@osamu2001
osamu2001 / clip_on_scrapbox.js
Created February 1, 2019 02:20
今見ているページを日付情報付きで記録する
javascript:(function () {
var title = document.title;
if (!title) return;
var lines = ['', window.location.href];
var quote = window.getSelection().toString();
if (quote.trim()) lines = lines.concat(quote.split(/\n/g).map(function (line) {
return ' > ' + line;
}));
var dt = new Date();
var y = dt.getFullYear();
from ubuntu:14.10
run apt-get -y install aptitude
run aptitude -y install software-properties-common
run sed -i s/archive.ubuntu.com/ftp.jaist.ac.jp/ /etc/apt/sources.list
run apt-add-repository -y ppa:fish-shell/release-2
run apt-get -y update
run apt-get -y install fish wget git
#run apt-get -y install emacs
run wget https://github.com/peco/peco/releases/download/v0.2.12/peco_linux_amd64.tar.gz
run tar zxvf peco_linux_amd64.tar.gz
@osamu2001
osamu2001 / docker-tramp-methods.el
Last active August 29, 2015 14:17
TRAMPを使ってdockerコンテナ内のファイルを開く ref: http://qiita.com/osamu2001/items/3058f7c3e3d8d9a6e532
;; http://www.emacswiki.org/emacs/TrampAndDocker
(push
(cons
"docker"
'((tramp-login-program "docker")
(tramp-login-args (("exec" "-it") ("%h") ("/bin/bash")))
(tramp-remote-shell "/bin/sh")
(tramp-remote-shell-args ("-i") ("-c"))))
tramp-methods)
require 'formula'
class PdfTools <Formula
url 'https://github.com/politza/pdf-tools/archive/master.zip'
homepage 'https://github.com/politza/pdf-tools/'
md5 '4278b81f7a105a491b5a8699f770c802'
def install
system "./configure", "--prefix=#{prefix}",
@osamu2001
osamu2001 / rsync.rb
Created October 7, 2013 02:28
brew install rsync 3.1.0
require 'formula'
class Rsync <Formula
url 'http://rsync.samba.org/ftp/rsync/src/rsync-3.1.0.tar.gz'
homepage 'http://rsync.samba.org/'
md5 '3be148772a33224771a8d4d2a028b132'
def install
system "./configure", "--prefix=#{prefix}",
@osamu2001
osamu2001 / mov2timestr.rb
Last active December 20, 2015 13:18
print mtime
#!/usr/bin/ruby
puts File.stat(ARGV[0]).mtime.strftime("%F %H.%M.%S.#{ARGV[1]}")
@osamu2001
osamu2001 / gist:5209845
Created March 21, 2013 00:47
find jpg files
find . -regextype posix-egrep -regex ".*/.*[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}\.[0-9]{2}\.[0-9]{2}\.jpg$"
#!/bin/sh
for p in IMG RIM CIM
do
exiftool -d '%Y-%m-%d %H.%M.%S.jpg' "-Filename<DateTimeOriginal" ${p}_*.JPG
for e in MOV PNG JPG
do
for f in `ls ${p}_*.${e}`
do
t=`mov2timestr.rb $f $e`
mv "$f" "$t"