Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
usage() {
local p=$(basename $0)
cat <<EOF >&2
$p - Convert between BMP and RGB565/RGB8888(RGB32)
Usage: $p input.bmp output.rgb32 [WxH]
Example:
$ $p foo.bmp foo.rgb32
$ $p foo.bmp foo.rgb565
#!/usr/bin/env python3
# -*- coding: utf-8-unix -*-
"""
Test for MXIC SPI Flash used in DSM-232
"""
import sys
import os
import time
import logging
#!/usr/bin/env python3
# -*- coding: utf-8-unix -*-
"""
An attempt to rewrite ucdev.register.* using ctypes.Structure.
Since ctypes.* and struct.* have been around for a long time,
it first seem that an interface ucdev.register is trying to
accomplish can somehow be done without reinventing the wheel
as current version of ucdev does. It turned out it's not the case.
#!/usr/bin/env node
const PPT = require('puppeteer');
const PDD = require('puppeteer/DeviceDescriptors');
const PuppeteerHar = require('puppeteer-har');
(async () => {
const ua = await PPT.launch({
headless: true,
args: ['--no-sandbox', '--disable-gpu'],
/*BINFMTCXX: -Wall -Wno-switch -lparquet -larrow
*/
#include <stdio.h>
#include "arrow/api.h"
#include "arrow/io/api.h"
#include "arrow/array.h"
#include "parquet/arrow/reader.h"
#include "parquet/arrow/schema.h"
#include "parquet/exception.h"
/*BINFMTCXX: -Wall -Wno-switch -lparquet -larrow
*/
#include <stdio.h>
#include "arrow/api.h"
#include "arrow/io/api.h"
#include "arrow/array.h"
#include "parquet/arrow/reader.h"
#include "parquet/arrow/schema.h"
#include "parquet/exception.h"
#!/usr/bin/env python3
import pcap
import time
def addr(pkt, offset):
return '.'.join(str(pkt[i]) for i in range(offset, offset + 4))
cap = pcap.pcap(name='br0', promisc=True, immediate=True, timeout_ms=50)
cap.setfilter('udp and port 8080')
# -*- coding: utf-8-unix -*-
def match_marriage(rank_from_b, rank_from_g):
"""Match boys and girls in stable manner"""
match = {}
# 女性が指定しなかった男性に与える(最下位の)ランキング値
rank_end = len(rank_from_g) + 1000
girls = list(rank_from_g.keys())
# -*- coding: utf-8 -*-
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.3'
# jupytext_version: 0.8.6
# kernelspec:
#!/usr/bin/env python3
# -*- coding: utf-8-unix -*-
"""
Flatten tree-encoded JSON data
"""
import sys
import json
from json import JSONDecoder