Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from optparse import OptionParser
import sys
import os
#==============================================================================
def put_chunk(f, chunk):
checksum = ((~sum(chunk)) + 1) & 0xff
@tako2
tako2 / img2pdf.py
Created June 14, 2021 15:33
画像ファイルを PDF に出力
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from PIL import Image
from reportlab.pdfgen import canvas
from reportlab.lib.pagesizes import A4
from reportlab.lib import pdfencrypt
from reportlab.lib.units import mm
from reportlab.lib.units import cm
@tako2
tako2 / dumplist.py
Created April 1, 2021 07:47
Dump binary file with check sums like pages published on retro pc magazines.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
from optparse import OptionParser
#==============================================================================
def dump_block(addr, data):
print('Add +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F :Sum')
idx = 0
@tako2
tako2 / ohm_off.json
Created December 11, 2017 03:21
IRKit's IR signal data for the remote outlet OHM's OCR-05W
{"format":"raw","freq":38,"data":[3394,5190,1778,1600,1806,3632,1756,1598,1806,1554,1754,3684,1744,1608,1752,3684,1754,3674,1754,107540,5272,5224,1756,1546,1762,3674,1752,1602,1762,1598,1762,3674,1756,1596,1764,3684,1744,3674,1806,107496,5228,5268,1704,1604,1756,3674,1806,1546,1764,1600,1806,3630,1756,1598,1806,3630,1756,3674,1754,107550,5220,5198,1782,1598,1762,3674,1754,1598,1810,1554,1756,3680,1756,1598,1762,3674,1754,3674,1808,107496,5222,5276,1702,1598,1764,3674,1754,1598,1764,1598,1764,3674,1752,1602,1806,3630,1754,3674,1752,107550,5222,5276,1692,1608,1756,3674,1806,1554,1756,1598,1762,3674,1756,1598,1762,3674,1754,3674,1756]}
@tako2
tako2 / index.js
Created December 11, 2017 03:09
this file is node.js module, place the file to node_module/irkit/index.js and change "esp_irkit.local" to "irkit.local" if needed.
var request = require('request');
var fs = require('fs');
function postMessages(body, callback)
{
var options = {
uri: 'http://esp_irkit.local/messages',
method: 'POST',
headers: { 'Content-Type': 'application/json',
'Content-Length': body.length },
@tako2
tako2 / arduboy_manager.py
Created September 28, 2017 09:46
Arduboy HEX File Manager for MacOS
#!/usr/bin/env python
# coding: UTF-8
# Arduboy HEX File Manager
import Tkinter
from ScrolledText import *
from PIL import Image, ImageEnhance, ImageTk
@tako2
tako2 / img2bmp.py
Last active August 20, 2016 00:47
Convert Image to Arduboy Bitmap
#!/usr/bin/env python
# coding: UTF-8
from PIL import Image, ImageEnhance
import Tkinter
from ScrolledText import *
###############################################################################
def draw_bitmap(canvas, rgb, max_xy, bmp_xy, start_xy, mask):
@tako2
tako2 / nmeaparser.py
Created June 4, 2016 09:00
Parse NMEA format to KML format
#!/usr/bin/env python
# coding: UTF-8
import sys
import StringIO
###############################################################################
class NMEAParser:
# -------------------------------------------------------------------------
def __init__(self):
@tako2
tako2 / get_image.js
Created November 15, 2015 06:13
node.js script for getting image file from THETA S.
var request = require('request');
var fs = require('fs');
if (process.argv.length < 3) {
console.log('node get_image.js [Filename]');
console.log("\tFilename: Image Filename such as R0010010.JPG");
return;
}
var file_uri = process.argv[2];
@tako2
tako2 / list_images.js
Created November 15, 2015 06:12
node.js script for getting list of images with THETA S API. it needs "request" module.
var request = require('request');
var options = {
uri: 'http://192.168.1.1/osc/commands/execute',
headers: { 'Content-Type': 'application/json;charset=utf-8' },
json: true,
keepAlive: false,
body: { "name": "camera.listImages",
"parameters": {
"entryCount": 100,