Skip to content

Instantly share code, notes, and snippets.

View maikebing's full-sized avatar
🦧
Out sick

maikebing

🦧
Out sick
View GitHub Profile
@maikebing
maikebing / ZipArchiveEntryOpenExtension.cs
Created September 26, 2023 02:36
Open ZipArchiveEntry checkOpenable extension
public static Stream Open(this ZipArchiveEntry entry, bool checkOpenable)
{
try
{
return entry.GetType().GetMethod("OpenInReadMode", BindingFlags.NonPublic | BindingFlags.Instance)
.Invoke(entry, new object[] { checkOpenable }) as Stream;
}
catch (TargetInvocationException ex1)
{

Merging Rubygems and Bundler

1.sh:

#!/bin/sh
set -eux
rm -rf rubygems bundler
git clone https://github.com/rubygems/rubygems
git clone https://github.com/rubygems/bundler
@npryce
npryce / merge-to-subdir
Last active February 22, 2024 17:23
Merge history from one Git repository as the history of a subdirectory of another Git repository
#!/bin/bash
# Usage: merge-to-subdir source-repo destination-repo subdir
#
# Merges the history of source-repo into destination-repo as the
# history of the subdirectory subdir.
#
# source-repo can be local or remote.
# destination-repo must be local to the machine.
# subdir can be a relative path, in which case intermediate