Skip to content

Instantly share code, notes, and snippets.


Simon Shields fourkbomb

View GitHub Profile
fourkbomb /
Last active Jun 22, 2019
basic diff between two device tree blobs, attempts to account for differing phandles
#!/usr/bin/env python
# Copyright (C) 2019 Simon Shields <>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
fourkbomb /
Created Sep 28, 2017
download source releases from samsung OSRC using a terminal
#!/usr/bin/env python3
# Copyright (c) 2017 Simon Shields
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
echo Purging old target_files...
rm out/dist/*target_files*
echo Making dist...
mka dist
echo Signing target files apks...
./build/tools/releasetools/sign_target_files_apks -o -d ~/.android-certs out/dist/*-target_files-*.zip $TARGET_FILES_SIGNED
echo Generating ota package...
OTA_PACKAGE=lineage-$(get_build_var LINEAGE_VERSION)
./build/tools/releasetools/ota_from_target_files -k ~/.android-certs/releasekey $TARGET_FILES_SIGNED $OTA_PACKAGE
#!/usr/bin/perl -ni
if (/app_name/) {
# strip surrounding spaces too1
s/(\S) +</$1</g;
s/> +(\S)/>$1/g;
if (/Copyright/) {
s/20.+? /2017 /g;
#!/usr/bin/perl -ni
s/CyanogenMod/LineageOS/g unless /copyright/i;
if (/Copyright/) {
s/20.+? /2017 /g;
s/Copyright/ /;
fourkbomb /
Last active Dec 22, 2018
switch from CM to Lineage non-destructively

Switch from CyanogenMod to LineageOS without redownloading everything

  1. Init the Lineage manifest: repo init -u ssh:// -b cm-14.1 (or cm-13.0 if you prefer that)
  2. Update your local manifest (.repo/local_manifests/roomservice.xml), if it exists - find and replace "CyanogenMod" with "LineageOS" globally.
  3. Move the git objects: mv .repo/project-objects/CyanogenMod .repo/project-objects/LineageOS
  4. curl > ~/
  5. chmod +x ~/
  6. cd .repo/projects
  7. find . -name '*.git' -exec ~/ {} \;
  8. And finally, fix the actual tree:
View kernels.json
"android_kernel_lge_msm8992": [
"android_kernel_oneplus_msm8996": [
"android_kernel_htc_msm8960": [
View out.json
"android_device_lge_jagnm": [
"android_device_lge_v410": [
"android_device_samsung_gts210wifi": [
fourkbomb /
Last active Feb 12, 2018
python script using requests to change the default branch for all repos owned by a user/organisation
from __future__ import print_function
import requests
BRANCH = 'cm-14.1'
REPO_OWNER = 'orgs/LineageOS'
USERNAME = 'your github username'
# generate this here:
# this script only needs the 'repo' scope
View i9300.xml
<?xml version="1.0" encoding="UTF-8"?>
<project name="fourkbomb/android_device_samsung_i9300" path="device/samsung/i9300" remote="github" revision="cm-14.0" />
<project name="fourkbomb/android_device_samsung_smdk4412-common" path="device/samsung/smdk4412-common" remote="github" revision="cm-14.0" />
<project name="fourkbomb/android_kernel_samsung_smdk4412" path="kernel/samsung/smdk4412" remote="github" revision="cm-14.0" />
<project name="CyanogenMod/android_packages_apps_SamsungServiceMode" path="packages/apps/SamsungServiceMode" remote="github" revision="cm-13.0" />
<project name="CyanogenMod/android_hardware_samsung" path="hardware/samsung" remote="github" revision="cm-14.0" />
<project name="CyanogenMod/android_external_stlport" path="external/stlport" remote="github" revision="cm-14.0" />
<project name="fourkbomb/proprietary_vendor_samsung" path="vendor/samsung" remote="github" revision="cm-14.0" />