Skip to content

Instantly share code, notes, and snippets.

View weimzh's full-sized avatar
🍎
Whistler

Wei Mingzhi weimzh

🍎
Whistler
View GitHub Profile
#!/usr/bin/env python3
#
# Convert entire rosbag to Apollo Cyber Record format.
#
# Copyright (c) 2023, Wei Mingzhi <whistler_wmz@users.sf.net>.
#
# SPDX-License-Identifier: BSD-3-Clause
# https://spdx.org/licenses/BSD-3-Clause.html
#
@weimzh
weimzh / msg_extract.py
Last active May 10, 2022 11:52
Extracting definition of customized messages from ROS bag files
#!/usr/bin/env python
#
# Copyright (c) 2022, Wei Mingzhi <whistler_wmz@users.sf.net>.
#
# SPDX-License-Identifier: BSD-3-Clause
# https://spdx.org/licenses/BSD-3-Clause.html
#
import sys
@weimzh
weimzh / multi_bag_reader.py
Last active April 25, 2022 03:22
multiple rosbag reader in python
# Copyright (c) 2022, Wei Mingzhi.
# Released under BSD License.
# https://opensource.org/licenses/BSD-3-Clause
import rosbag
class _PriorityQueue(object):
def __init__(self):
self.queue = []
@weimzh
weimzh / smsreader_ec122.py
Last active November 19, 2023 11:31
Quick and dirty code to read and send SMS messages for Huawei EC122 CDMA Modem. Might be buggy, use with caution.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2022, Wei Mingzhi <whistler_wmz@users.sf.net>.
# SPDX-License-Identifier: BSD-3-Clause
# https://spdx.org/licenses/BSD-3-Clause.html
#
# Quick and dirty code to read and send SMS messages for Huawei EC122 CDMA Modem.
#
# Most likely this will NOT work with any other GSM/CDMA phones/modems, as the AT
@weimzh
weimzh / install-alpine-on-thinkpad-t400.md
Last active January 4, 2022 08:15
Install Alpine Linux on Libreboot T400

Install Alpine Linux on Libreboot T400

  • Download Alpine Linux 3.15 ISO from the official website and write to a USB media:
dd if=alpine-extended-3.15.0-x86_64.iso of=/dev/sdc

Replace /dev/sdc with the your USB Device.

  • Boot from the USB. For Libreboot, select the "Search ISOLINUX menu (USB)" option in the GRUB menu.
@weimzh
weimzh / proj.c
Last active August 13, 2021 03:27
projecting 3d points to 2d in webassembly
// Copyright (c) 2021, Wei Mingzhi.
// Released under BSD License.
// https://opensource.org/licenses/BSD-3-Clause
/*
compile with:
clang --target=wasm32 \
-O3 \
-flto -nostdlib \
@weimzh
weimzh / intset.js
Last active February 21, 2024 07:23
javascript integer set implemented with bitmap
// Copyright (c) 2021, Wei Mingzhi <whistler_wmz@users.sf.net>.
// SPDX-License-Identifier: BSD-2-Clause
const IntSet = function () {
this.data = [];
this.size = 0;
};
IntSet.prototype.add = function (num) {
const index = num >> 5;
@weimzh
weimzh / json2painless.py
Last active May 14, 2020 07:59
simple code to convert json to elasticsearch painless for update_by_query.
# Copyright (c) 2020, Wei Mingzhi <whistler_wmz at users.sf.net>.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the