Skip to content

Instantly share code, notes, and snippets.

@rluvaton
rluvaton / README.md
Last active September 17, 2024 11:27
Bundle install for mac that temporarly disable IPv6 for network interface while downloading

Fixed bundle install for MacOS

This is a zx script that fix bundle install

How to run:

The bundle-install file should be without extension (but not required) added the extension to make GitHub syntax highlighting work

So from now we just gonna use bundle-install instead of bundle-install.mjs

@rrottmann
rrottmann / dist-upgrade-buster-to-bookworm.sh
Last active June 8, 2026 15:46
Dist-Upgrade Debian 10 Buster to Debian 12 Bookworm
# Debian 10
apt-get -y update
apt-get -y upgrade --without-new-pkgs
apt-get -y full-upgrade
cat > /etc/apt/sources.list <<"EOF"
deb http://deb.debian.org/debian/ bullseye main
deb-src http://deb.debian.org/debian/ bullseye main
deb http://security.debian.org/bullseye-security bullseye-security/updates main
deb-src http://security.debian.org/bullseye-security bullseye-security/updates main
@bartekpacia
bartekpacia / RunnerTests.m
Last active May 2, 2025 14:39
This snippet shows how to dynamically create test cases in XCTest.
@import XCTest;
@import ObjectiveC.runtime;
@interface ParametrizedTests : XCTestCase
@end
@implementation ParametrizedTests
+ (NSArray<NSInvocation *> *)testInvocations {
NSLog(@"testInvocations() called");
@hartfordfive
hartfordfive / README.md
Last active November 12, 2025 00:39
Git pre-commit hook to verify committer email

Description

The goal of this hook is to allow you catch when you're committing with an email you shouldn't on a public repositories. In some cases, certain companies need to seperate their internal coporate email accounts from those that might be used for committing to public repositories.

Setting up.

The UNWANTED_EMAIL_SUFFIX should be the suffix (after the @ sign) of the email address you do not want to appear in the git logs. The DESIRED_AUTHOR_EMAIL and DESIRED_AUTHOR_NAME are the respective email and name you want to show up in the git logs.

@alfianlosari
alfianlosari / docc_static_hostling_cli_command
Created February 17, 2022 08:46
Docc command for generating static site hosting with Xcode > 13.3
// Generate docarhive file using xcodebuild to custom derived data path
xcodebuild docbuild \
-scheme YOUR_TARGET_NAME \
-derivedDataPath PATH_TO_SAVE_DERIVED_DATA_FOLDER \
-destination 'platform=iOS Simulator,name=iPhone 13'
// Find docarchive file in the build derived data path
find PATH_TO_SAVE_DERIVED_DATA_FOLDER -type d -name '*.doccarchive'
@yoxisem544
yoxisem544 / KeychainStorage.swift
Created November 5, 2020 03:26
Property wrapper of keychain store
import Foundation
import KeychainAccess
//https://www.swiftbysundell.com/articles/property-wrappers-in-swift/
public protocol AnyOptional {
var isNil: Bool { get }
}
extension Optional: AnyOptional {
public var isNil: Bool { self == nil }
@jensim
jensim / add_default_reviewers.sh
Last active June 6, 2024 21:44
Add default reviewers to bitbucket-server pull requests where there are currently 0 reviewers
#!/bin/bash
#set -x
set -e
host='https://my-code.local'
if ! which jq ; then
echo 'jq not installed.' >&2
exit 1
@bryanbraun
bryanbraun / git-branching-diagram.md
Last active April 27, 2026 22:55
Example Git Branching Diagram

Example Git Branching Diagram

You can use this diagram as a template to create your own git branching diagrams. Here's how:

  1. Create a new diagram with diagrams.net (formerly draw.io)
  2. Go to File > Open From > URL
  3. Insert this url (it points to the xml data below): https://gist.githubusercontent.com/bryanbraun/8c93e154a93a08794291df1fcdce6918/raw/bf563eb36c3623bb9e7e1faae349c5da802f9fed/template-data.xml
  4. Customize as needed for your team.

@marlosirapuan
marlosirapuan / gist:778d6beda5f8ab95695748011c864b19
Last active June 16, 2026 22:24
Download .m3u8 files on MacOS

Install ffmpeg

brew install ffmpeg

Download file through url, like this:

ffmpeg -protocol_whitelist file,http,https,tcp,tls,crypto -i "http://url-file.domain.m3u8" -c copy video.mp4
@emctague
emctague / TupleToArray.swift
Created January 29, 2020 00:24
Tuple to Array Conversion for Swift
/**
# Tuple-to-array for Swift
By Ethan McTague - January 28, 2020
This source code is in the public domain.
## Example
To convert a tuple of Ints into an array of ints: