Skip to content

Instantly share code, notes, and snippets.

View seikichi's full-sized avatar
💭
社畜

Seiichi KONDO seikichi

💭
社畜
View GitHub Profile
@seikichi
seikichi / cloudSettings
Last active March 10, 2022 08:40
Visual Studio Code Settings Sync Gist
{"lastUpload":"2019-12-01T13:33:49.180Z","extensionVersion":"v3.4.3"}
;;
;; An autohotkey script that provides emacs-like keybinding on Windows
;;
#InstallKeybdHook
#UseHook
; The following line is a contribution of NTEmacs wiki http://www49.atwiki.jp/ntemacs/pages/20.html
SetKeyDelay 0
; turns to be 1 when ctrl-x is pressed
@seikichi
seikichi / scratch.rs
Created April 21, 2019 15:02
ConPTY scratch
// ConPTY 手習い (with winapi-rs, vte)
//
// https://github.com/jwilm/alacritty/blob/master/src/tty/windows/conpty.rs
// https://github.com/chyyran/conmux/blob/master/src/conpty.rs
// https://devblogs.microsoft.com/commandline/windows-command-line-introducing-the-windows-pseudo-console-conpty/
use std::fs::File;
use std::io::prelude::*;
use std::io::Write;
use std::mem;
@seikichi
seikichi / fiddle.css
Last active December 28, 2015 21:39
jsfiddle test
body {}
@seikichi
seikichi / title.py
Last active December 19, 2015 09:09
#!/usr/bin/python
# -*- coding: utf-8 -*-
# http://futaba.qs.cjb.net/nijiran/fCatalog_MAY.html のタイトル取得が
# うまく出来んと言われたのでやってみた (なげやり)
# lxml は charset 適当に見つけたら上手いこと decode してくれるので
# response.text じゃなくて response.content を lxml.html.fromstring に
# 渡せばいいよとかそんな話
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Example: python3 kasi_time.py 65532
import sys
from selenium import webdriver
if len(sys.argv) != 2:
print('Usage: kasi_time.py id', file=sys.stderr)
#ifndef LUAHELPER_HPP
#define LUAHELPER_HPP
#include <iostream>
#include <memory>
#include <string>
#include <tuple>
#include <lua.hpp>
@seikichi
seikichi / kakan.cpp
Created May 9, 2011 03:38
サークルの講座用(2011/5/9)
/*
サークルの講座用に書いた何か.
`もう/もう 何/なに も/も 怖/コワ く/く な/な い/い 。/。`
という形式のコーパスを読み込んで仮名漢字変換っぽい何かをします.
未知語とか何も考えてない上にスムージングのパラメータも適当でこれはひどい.
「EUCだから1文字2バイトだろ」とか決め打ちでこれはひどい.
全体的に富豪気味でこれはひどい.
using namepsace std; もぐもぐ!
@seikichi
seikichi / isbn2title.py
Created March 1, 2011 19:46
ISBNをAmazon APIに投げて自炊した本のタイトル向けの文字列を出力
#!/usr/bin/python
# -*- coding: utf-8 -*-
# http://docs.amazonwebservices.com/AWSECommerceService/latest/DG/
from sys import argv
from time import gmtime, strftime
from urllib import urlencode, urlopen
from xml.etree import ElementTree as ET
from base64 import b64encode
@seikichi
seikichi / isbnfilename.sh
Created March 1, 2011 19:29
自炊したpdfから最初と最後の3ページの画像を確認してバーコードを探しファイル名を"<ISBN13>.pdf" に変換.
#!/bin/bash
rm -f .image*
CHECK=3
for file in *.pdf; do
pages=$(pdfinfo "$file" | grep -E '^Pages' | sed -e 's/^Pages:\s*//') &&
pdfimages -j -l $CHECK "$file" .image_h &&
pdfimages -j -f $(expr $pages - $CHECK) "$file" .image_t &&
title="$(zbarimg -q .image* | uniq | grep -E '^EAN-13:978' | sed -e 's/^EAN-13://').pdf" &&