Skip to content

Instantly share code, notes, and snippets.

@trsqxyz
trsqxyz / cmppfmMrgsrc.md
Last active December 20, 2015 11:19
ILERPG PDM AS/400 での diff の保管 差分のみの更新について

cmppfm

受入ファイルの作成

CRTPF FILE(*LIB/QDIFF) RCDLEN(144) FILETYPE(*SRC) MBR(*NONE) IGCDTA(*YES) MAXMBRS(*NOMAX) CCSID(5035) AUT(*ALL)

頭の 12 バイトはヘッダの情報なので 144 = 132 + 12 としておかないと変更行の情報が削除される

@trsqxyz
trsqxyz / gist:6149683
Last active December 20, 2015 14:49
git push や pull をしたときに permission denied (publickey) が出てしまった場合

公開鍵の設定をして

ssh -T [email protected]

も成功していたけど git pushgit pull もできなくなった
公開鍵の再作成 再登録後に ~/.ssh/ に config をつくって

Host github.com
User git
Port 22
Hostname github.com
port 22

@trsqxyz
trsqxyz / gist:6295368
Created August 21, 2013 14:41
DBGrid value export to Excel worksheet (cell).
Worksheet.Cells[i,j].Value := Fields[j].Value;
Next;
@trsqxyz
trsqxyz / columnedit.py
Last active December 22, 2015 08:59
Delphi のカラムエディタ用に FieldName と Title.Caption を書き出す。 field.txt に FieldName 、title.txt に Title.Caption を一行づつ書く。 DBGrid をエディタ表示にして item.txt を貼り付ける。
# -*- coding: utf-8 -*-
"""
For Delphi7 column editor set FieldName and Title.Caption.
Write FieldName to field.txt, Title.Caption to title.txt.
Result in item.txt
"""
with open('item.txt', 'w') as item:
with open('field.txt') as field, open('title.txt') as title:
expanded = '\t\titem\n\t\tExpanded = False\n'
@trsqxyz
trsqxyz / fileMove.py
Last active December 26, 2015 00:39
任意の拡張子のファイルを移動する move file of select suffix
# -*- coding: utf-8 -*-
import os
import shutil
#src -> dst
src = u'/Users/name/Downloads/'
dst = {'.jpg': u'/Users/name/Library/jpg/',
}
for suffix, path in dst.items():
@trsqxyz
trsqxyz / ping
Last active December 30, 2015 11:29
ping command
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import shlex, subprocess
class Ping():
def __init__(self):
self.hosts = {'Google': '173.194.38.82'}
def ping(self, check=[], count=1):
prm = len(self.hosts)
for host in self.hosts:
@trsqxyz
trsqxyz / random_oneliner.py
Last active December 31, 2015 17:09
practice random onliner
from random import *;L=range(10);shuffle(L);L
% pip install pyrtm
% cd ./rtm/samples
% python app.py [API KEY] [SHARED SECRET]
@trsqxyz
trsqxyz / file0.txt
Created January 15, 2014 12:40
どうやってコードを書けばいいのかな? というときに役立つかもしれない howdoi ref: http://qiita.com/trsqxyz@github/items/d668bc78621c70dcfd51
% howdoi format dict python
geopoint = {'latitude':41.123,'longitude':71.091}
print('{latitude} {longitude}'.format(**geopoint))
%howdoi install homebrew
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go/install)"
%howdoi print golang
return fmt.Sprintf("at %v, %s", e.When, e.What)
@trsqxyz
trsqxyz / gist:9002158
Created February 14, 2014 14:43
The difference between Python 2.7.5 and Python 3.3.3
Python 2.7.5 (default, Aug 25 2013, 00:04:04)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> data = 'spam123'
>>> bool(filter(lambda s:s.isupper(),data))
False
Python 3.3.3 (v3.3.3:c3896275c0f6, Nov 16 2013, 23:39:35)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.