Skip to content

Instantly share code, notes, and snippets.

@joyrexus
joyrexus / README.md
Last active December 30, 2024 01:37
collapsible markdown

collapsible markdown?

CLICK ME

yes, even hidden code blocks!

print("hello world!")
@u1735067
u1735067 / gptbin_reader.py
Last active February 9, 2023 16:23
Python gpt.bin decoder (gpt.bin for Xiaomi MiPad2, but probably for other plateforms too) ; you'll want https://gist.github.com/u1735067/b3a23c9461e95433387f285f6e0860ca
#!python3
''' BSD 3-Clause License — but if it was useful to you, you may tell me :)
Copyright (c) 2016-2017, Alexandre Levavasseur
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
@AvnerCohen
AvnerCohen / sorted_git_tags.md
Last active July 21, 2018 18:39
A sorted list of git tags - A simple way to create a git alias to a sorted list of tags, sorted by their creation date, and not alphanumerically.

Extract a sorted by creation list list of git repository tags:

The git command line:

git for-each-ref --format='%(*committerdate:raw)%(committerdate:raw) %(refname) %(*objectname) %(objectname)' refs/tags | sort -n | cut -d'/' -f 3 | cut -d' ' -f 1

Create a new git alias for it (stags - Sorted tags):

@msrose
msrose / combining-git-repositories.md
Last active May 20, 2025 14:44
How to combine two git repositories.

Combining two git repositories

Use case: You have repository A with remote location rA, and repository B (which may or may not have remote location rB). You want to do one of two things:

  • preserve all commits of both repositories, but replace everything from A with the contents of B, and use rA as your remote location
  • actually combine the two repositories, as if they are two branches that you want to merge, using rA as the remote location

NB: Check out git subtree/git submodule and this Stack Overflow question before going through the steps below. This gist is just a record of how I solved this problem on my own one day.

Before starting, make sure your local and remote repositories are up-to-date with all changes you need. The following steps use the general idea of changing the remote origin and renaming the local master branch of one of the repos in order to combine the two master branches.