Skip to content

Instantly share code, notes, and snippets.

@drinkcat
drinkcat / mbox-split.py
Last active July 3, 2024 04:17
Split gmail takeout MBOX file per year
# Split a mbox file per year
import os
import sys
MATCH = b'\r\n\r\nFrom '
OFFSET = 4 # 2 pairs of \r\n above
BUFSIZE = 1024*1024
outfiles = {}
[ 1467.671262] [IGT] panfrost_submit: executing
[ 1467.683470] [IGT] panfrost_submit: starting subtest pan-reset
[ 1467.696570] ------------[ cut here ]------------
[ 1467.696658] WARNING: CPU: 0 PID: 2158 at /mnt/host/source/src/third_party/kernel/v4.19/drivers/gpu/drm/panfrost/panfrost_mmu.c:591 panfrost_mmu_irq_handler_thread+0x52c/0x588 [panfrost]
[ 1467.696663] Modules linked in: rfcomm uinput mtk_vcodec_enc cros_ec_rpmsg mtk_dip mtk_cam_isp mtk_fd mtk_seninf mtk_vcodec_dec mtk_mdp3 mtk_vcodec_common videobuf2_dma_contig videobuf2_memops v4l2_mem2mem videobuf2_v4l2 panfrost videobuf2_common gpu_sched hci_uart hid_google_hammer btqca ov02a10 ov8856 bluetooth v4l2_fwnode dw9768 ecdh_generic mtk_scp mtk_rpmsg rpmsg_core mtk_scp_ipi ipt_MASQUERADE fuse iio_trig_sysfs cros_ec_light_prox cros_ec_sensors_sync cros_ec_sensors cros_ec_sensors_ring cros_ec_activity industrialio_triggered_buffer kfifo_buf cros_ec_sensors_core cdc_ether usbnet ath10k_sdio r8152 ath10k_core mii ath mac80211 lzo_rle cfg80211 lzo_compr
[ 1215.234937] [IGT] panfrost_submit: executing
[ 1215.318446] [IGT] panfrost_submit: starting subtest pan-submit
[ 1215.338239] ------------[ cut here ]------------
[ 1215.338337] WARNING: CPU: 0 PID: 2158 at /mnt/host/source/src/third_party/kernel/v4.19/drivers/gpu/drm/panfrost/panfrost_mmu.c:591 panfrost_mmu_irq_handler_thread+0x52c/0x588 [panfrost]
[ 1215.338343] Modules linked in: rfcomm uinput mtk_vcodec_enc cros_ec_rpmsg mtk_dip mtk_cam_isp mtk_fd mtk_seninf mtk_vcodec_dec mtk_mdp3 mtk_vcodec_common videobuf2_dma_contig videobuf2_memops v4l2_mem2mem videobuf2_v4l2 panfrost videobuf2_common gpu_sched hci_uart hid_google_hammer btqca ov02a10 ov8856 bluetooth v4l2_fwnode dw9768 ecdh_generic mtk_scp mtk_rpmsg rpmsg_core mtk_scp_ipi ipt_MASQUERADE fuse iio_trig_sysfs cros_ec_light_prox cros_ec_sensors_sync cros_ec_sensors cros_ec_sensors_ring cros_ec_activity industrialio_triggered_buffer kfifo_buf cros_ec_sensors_core cdc_ether usbnet ath10k_sdio r8152 ath10k_core mii ath mac80211 lzo_rle cfg80211 lzo_comp
@drinkcat
drinkcat / lastseen.sh
Created January 7, 2015 19:06
Last time a given Chromium OS was active in any stable channel
#!/bin/sh -e
set -e
wget http://cros-omahaproxy.appspot.com/history -O history
grep "stable-channel" history | awk -F, '
{
"date -d\"" $1 "\" +\"%s\"" | getline date
version=$2
@drinkcat
drinkcat / gist:8209d412a25a1a0f79f6
Created October 7, 2014 20:25
Mount ext4 loop/dm device on FAT32
#!/bin/sh
set -e -x
losetup /dev/loop10 ext4.bin_01
losetup /dev/loop11 ext4.bin_02
size1=$(blockdev --getsz /dev/loop10)
size2=$(blockdev --getsz /dev/loop11)
dmsetup create crouton << EOF
0 $size1 linear /dev/loop10 0
@drinkcat
drinkcat / debootstrap.log
Created August 17, 2014 03:29
sid bootstrap error
dpkg: warning: parsing file '/var/lib/dpkg/status' near line 5 package 'dpkg':
missing description
dpkg: warning: parsing file '/var/lib/dpkg/status' near line 5 package 'dpkg':
missing architecture
Selecting previously unselected package base-passwd.
(Reading database ... 0 files and directories currently installed.)
Preparing to unpack .../base-passwd_3.5.33_amd64.deb ...
Unpacking base-passwd (3.5.33) ...
dpkg: base-passwd: dependency problems, but configuring anyway as you requested:
base-passwd depends on libc6 (>= 2.8); however:
@drinkcat
drinkcat / x11-downgrade
Last active August 29, 2015 14:03
Downgrade Mesa to version 8 for >precise on kernel 3.4 (improved)
#!/bin/sh -e
# Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Add this target by using -T /path/to/x11-downgrade at install/update time
#
# This target is easily removed by running
# rm /etc/apt/sources.list.d/precise.list
# rm /etc/apt/preferences.d/precise-mesa-pin
@drinkcat
drinkcat / downgrade.sh
Last active August 29, 2015 14:02
Downgrade Mesa to version 8 for >precise on kernel 3.4
echo -n "libegl1-mesa_8.0.4-0ubuntu0.7_amd64.deb libegl1-mesa-drivers_8.0.4-0ubuntu0.7_amd64.deb libgl1-mesa-dri_8.0.4-0ubuntu0.7_amd64.deb libgl1-mesa-glx_8.0.4-0ubuntu0.7_amd64.deb libglapi-mesa_8.0.4-0ubuntu0.7_amd64.deb libgles2-mesa_8.0.4-0ubuntu0.7_amd64.deb" | xargs -d' ' -I{} wget http://mirrors.kernel.org/ubuntu/pool/main/m/mesa/{}
wget http://mirrors.kernel.org/ubuntu/pool/main/libd/libdrm/libdrm-nouveau1a_2.4.46-1ubuntu0.0.0.1_amd64.deb
wget http://mirrors.kernel.org/ubuntu/pool/main/l/llvm-3.0/libllvm3.0_3.0-4ubuntu1_amd64.deb
wget http://mirrors.kernel.org/ubuntu/pool/main/u/udev/libudev0_175-0ubuntu9.5_amd64.deb
sudo apt-get install libwayland0
sudo dpkg -r --force-depends libwayland-egl1-mesa
sudo dpkg -i *.deb
@drinkcat
drinkcat / 2014-06-13_02-21-12_drinkcat_chroagh_x11test.tmp_35.html
Last active August 29, 2015 14:02
OpenGL machine vs release matrix
<html><body><pre>
2014-06-13_02-21-12_drinkcat_chroagh_x11test.tmp_35/
</pre><table border=1>
<tr><td></td>
<td>wheezy</td>
<td>jessie</td>
<td>sid</td>
<td>kali</td>
<td>precise</td>
<td>saucy</td>
@drinkcat
drinkcat / testsig.sh
Last active August 29, 2015 13:59
Test if kernel is signed
verifykernelsig() {
dev_debug_vboot -c -i "`rootdev -s -d`" | tee /tmp/dev_debug_vboot
echo "Checking output:"
cat /tmp/dev_debug_vboot | mawk '
!/^ / {
label = ""
}
/^Kernel / {
sub(/:$/, "", $2)
( "blkid -o value -s PARTLABEL " $2) | getline label