Skip to content

Instantly share code, notes, and snippets.

View kylemanna's full-sized avatar

Kyle Manna kylemanna

View GitHub Profile
@kylemanna
kylemanna / dmesg-btrfs-crash.txt
Created May 13, 2013 03:07
BTRFS crash which resulted in all disk IO to my root filesystem to hang. :-/ USB warning before the filesystem crash was likely due to hot-unplugging my Nexus 4.
[ 0.000000] Initializing cgroup subsys cpuset
[ 0.000000] Initializing cgroup subsys cpu
[ 0.000000] Linux version 3.9.0-0-generic (root@core) (gcc version 4.7.3 (Ubuntu/Linaro 4.7.3-1ubuntu1) ) #4 SMP Sun May 5 20:29:06 PDT 2013 (Ubuntu 3.9.0-0.4-generic 3.9.0)
[ 0.000000] Command line: BOOT_IMAGE=/vmlinuz-3.9.0-0-generic root=UUID=97ab20e5-14f9-4aa1-b7e3-5324702fa981 ro rootflags=subvol=@ quiet splash vt.handoff=7
[ 0.000000] KERNEL supported cpus:
[ 0.000000] Intel GenuineIntel
[ 0.000000] AMD AuthenticAMD
[ 0.000000] Centaur CentaurHauls
[ 0.000000] e820: BIOS-provided physical RAM map:
[ 0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009dbff] usable
@kylemanna
kylemanna / gnome-keyring.py
Created May 14, 2013 07:04
Very handy script for accessing Gnome keyring from python. Mirrored here so I don't lose it :)
#
# Original author: http://www.rittau.org/blog/20070726-01
# Original code: http://www.rittau.org/gnome/python/keyring.py
#
__version__ = "$Revision: 14294 $"
import gtk # ensure that the application name is correctly set
import gnomekeyring as gkey
@kylemanna
kylemanna / real-size.sh
Last active December 17, 2015 18:29
Read the actual size of data files for comparison with wasted space to poor block allocation fit.
#!/bin/bash
# usage: ./real-size.sh <directory>
if [ -z "$1" ]; then
echo Provide directory argument
exit 1
fi
find $1 -type f -print0 | \
xargs -0 stat --format=%s | \
@kylemanna
kylemanna / dmesg.2013.05.28.log
Created May 28, 2013 07:01
Failing OCZ Agility 2 SSD
[67873.504490] btrfs csum failed ino 2814 extent 18735104 csum 2566472073 wanted 1550764569 mirror 0
[67873.504582] btrfs csum failed ino 2814 extent 18735104 csum 2566472073 wanted 1550764569 mirror 0
[67875.972459] btrfs csum failed ino 2814 extent 18735104 csum 2566472073 wanted 1550764569 mirror 0
[67905.682555] btrfs csum failed ino 2814 extent 18735104 csum 2566472073 wanted 1550764569 mirror 0
[80612.424338] btrfs csum failed ino 114607 extent 5127675904 csum 2566472073 wanted 2346267106 mirror 0
[80612.424346] btrfs csum failed ino 114607 extent 5127778304 csum 2566472073 wanted 745667138 mirror 0
[80612.424420] btrfs csum failed ino 114607 extent 5127876608 csum 2566472073 wanted 21024237 mirror 0
[80612.424428] btrfs csum failed ino 114607 extent 5127991296 csum 2566472073 wanted 3090103677 mirror 0
[80612.424500] btrfs csum failed ino 114607 extent 5128101888 csum 2566472073 wanted 1136036514 mirror 0
[80612.424508] btrfs csum failed ino 114607 extent 5128224768 csum 2566472073 wanted 1308107691 mi
@kylemanna
kylemanna / backup-rootfs.sh
Created May 28, 2013 07:07
Backup rootfs to brace for failing SSD
#!/bin/bash
sudo tar cf - --one-file-system / /boot | bar | lbzip2 -cs > /mnt/backup/sda5-rootfs.$(date +%Y.%m.%d).tar.bz2
@kylemanna
kylemanna / ocz.agility2.dying.smartctl.log
Created May 28, 2013 07:21
SMART data from the dying OCZ Agility 2
smartctl 5.43 2012-06-30 r3573 [x86_64-linux-3.9.4-030904-generic] (local build)
Copyright (C) 2002-12 by Bruce Allen, http://smartmontools.sourceforge.net
=== START OF INFORMATION SECTION ===
Model Family: SandForce Driven SSDs
Device Model: OCZ-AGILITY2
Serial Number: xxxxxxxxx
LU WWN Device Id: x xxx xxxxxxx
Firmware Version: 1.37
User Capacity: 120,034,123,776 bytes [120 GB]
@kylemanna
kylemanna / android-ca-cert-hash.sh
Last active June 27, 2025 22:41
Generate hash file name for Root CAs on Android. Handy for things like mitmproxy.
CERT=$1
NAME=$(openssl x509 -in $HOME/.mitmproxy/mitmproxy-ca-cert.cer -subject_hash_old -noout)
cp ${CERT} ${OUT}/system/etc/security/cacerts/${NAME}.0
@kylemanna
kylemanna / check-ip.c
Last active December 17, 2015 23:38
Program used to control ssh execution. Example usage: "./check-ip 192.168.0.0/16 /path/to/trusted/command arg1". Or could be used in an authorized_keys file with SSH_ORIGINAL_COMMAND set.
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <arpa/inet.h>
#include <assert.h>
#include <unistd.h>
#ifndef CMD_DEFAULT
#define CMD_DEFAULT "/bin/bash"
#endif
@kylemanna
kylemanna / parse-ext-csd.py
Last active July 13, 2026 15:39
Parse eMMC Extended CSD and print useful things.
#!/usr/bin/env python
"""
Author: Kyle Manna <kyle@kylemanna.com>
Blog: https://blog.kylemanna.com
cat /d/mmc0/mmc0:0001/ext_csd
0000000000000001030100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000087a0000000000000000061502030700100608010101080800100000728000000808080808080000000000010200070002000500000000000001000200000000000000000000000000000100050000000000030001ca00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
@kylemanna
kylemanna / tcpbridge-to-tap.py
Created June 18, 2013 22:38
Python tap0 + tcpbridge for Mac OS X to attempt to pass tagged VLAN traffic to VirtualBox guests VMs
#!/usr/bin/env python
#
# Create a tap0 interface on Mac OS X and start a tcp bridge to copy all frames to the tap0 interface.
# This helps pass tagged VLAN packets to a VirtualBox VM when that vm is bridged to tap0
#
# This is also very slow. Sigh. Maybe someday Mac OS X will fix the kernel bridging
# for VLANs. Right now it seems to be impossible to bridge trunked VLAN interfaces
# and virtual VLAN interfaces.
#
#