Skip to content

Instantly share code, notes, and snippets.

View prom3theu5's full-sized avatar
🏡
Working from Home

David Sekula prom3theu5

🏡
Working from Home
  • UK
  • 01:39 (UTC +01:00)
View GitHub Profile
@prom3theu5
prom3theu5 / resign-ipa.md
Created July 30, 2023 23:10 — forked from ryantan/resign-ipa.md
How to resign an .ipa

How to Resign an iOS App

Let's say you receive an app (e.g. MyApp.ipa) from another developer, and you want to be able to install and run it on your devices (by using ideviceinstaller, for example).

Or your certificates and provision profiles have expired and you want to provide a new build to your clients without having to make a new build on the latest XCode or iOS SDK.

Prepare New Signing Assets

The first step is to attain a Provisioning Profile which includes all of the devices you wish to install and run on. Ensure that the profile contains a certificate that you have installed in your Keychain Access (e.g. iPhone Developer: Some Body (XXXXXXXXXX) ). Download the profile (MyProfile.mobileprovision) so you can replace the profile embedded in the app.

#!/bin/bash
killall Xcode
xcrun -k
xcodebuild -alltargets clean
rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang/ModuleCache"
rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang.$(whoami)/ModuleCache"
sudo rm -rf /Applications/Xcode.app
rm -rf ~/Library/Caches/com.apple.dt.Xcode
rm -rf ~/Library/Developer
rm -rf ~/Library/MobileDevice
@prom3theu5
prom3theu5 / Whatever.cmd
Created May 24, 2022 17:48
2nd instance of teams
@ECHO OFF
REM Uses the file name as the profile name
SET MSTEAMS_PROFILE=%~n0
ECHO - Using profile "%MSTEAMS_PROFILE%"
SET "OLD_USERPROFILE=%USERPROFILE%"
SET "USERPROFILE=%LOCALAPPDATA%\Microsoft\Teams\CustomProfiles\%MSTEAMS_PROFILE%"
ECHO - Launching MS Teams with profile %MSTEAMS_PROFILE%
cd "%OLD_USERPROFILE%\AppData\Local\Microsoft\Teams"
"%OLD_USERPROFILE%\AppData\Local\Microsoft\Teams\Update.exe" --processStart "Teams.exe"
@prom3theu5
prom3theu5 / 01-docker-tls.sh
Created March 4, 2022 16:56 — forked from zigarn/01-docker-tls.sh
Generate Docker certificates for training on TLS
# Configuration
export PUBLIC_DNS=<public hostname>
export PUBLIC_IP=<public host IP>
export PRIVATE_IP=<private host IP>
mkdir docker-ca
chmod 0700 docker-ca/
cd docker-ca/
# CA key
@prom3theu5
prom3theu5 / Docker connect to remote server.md
Created March 1, 2022 21:26 — forked from kekru/Docker connect to remote server.md
Connect to another host with your docker client, without modifying your local Docker installation

Run commands on remote Docker host

This is how to connect to another host with your docker client, without modifying your local Docker installation or when you don't have a local Docker installation.

Enable Docker Remote API

First be sure to enable the Docker Remote API on the remote host.

This can easily be done with a container.
For HTTP connection use jarkt/docker-remote-api.

@prom3theu5
prom3theu5 / Policy.cs
Created January 27, 2020 00:09
RetryAfter Read Headers
private TimeSpan getServerWaitDuration(DelegateResult<HttpResponseMessage> response)
{
var retryAfter = response?.Result?.Headers?.RetryAfter;
if (retryAfter == null)
return TimeSpan.Zero;
return retryAfter.Date.HasValue
? retryAfter.Date.Value - DateTime.UtcNow
: retryAfter.Delta.GetValueOrDefault(TimeSpan.Zero);
}
@prom3theu5
prom3theu5 / Policy.cs
Created January 26, 2020 23:58
Polly AuthRefresh
var authorisationEnsuringPolicy = Policy
.HandleResult<HttpResponseMessage>(r => r.StatusCode == HttpStatusCode.Unauthorized)
.RetryAsync(
retryCount: 1, // Consider how many retries. If auth lapses and you have valid credentials, one should be enough; too many tries can cause some auth systems to blacklist.
onRetryAsync: async (outcome, retryNumber, context) => FooRefreshAuthorizationAsync(context),
/* more configuration */);
var response = authorisationEnsuringPolicy.ExecuteAsync(context => DoSomethingThatRequiresAuthorization(context), cancellationToken);
@prom3theu5
prom3theu5 / Policy.cs
Created January 26, 2020 23:37
Polly Resiliency for Azure Cognitive Services etc
/// <summary>
/// Creates a Polly-based resiliency strategy that helps deal with transient faults when communicating
/// with the external (downstream) Computer Vision API service.
/// </summary>
/// <returns></returns>
private PolicyWrap<HttpResponseMessage> DefineAndRetrieveResiliencyStrategy()
{
// Retry when these status codes are encountered.
HttpStatusCode[] httpStatusCodesWorthRetrying = {
HttpStatusCode.InternalServerError, // 500
{
"version": "0.0.1",
"discord": {
"clientId": "568451050181492736",
"smallImageText": "Score",
"smallImageKey": "seal-circle"
},
"java": {
"oracle": "http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html"
},
@prom3theu5
prom3theu5 / Ecommerce.cs
Created July 26, 2016 15:00
BCD Google Tracking ECOmmerce
public class WidgetsGoogleAnalyticsController : BasePluginController
{
private readonly IWorkContext _workContext;
private readonly IStoreContext _storeContext;
private readonly IStoreService _storeService;
private readonly ISettingService _settingService;
private readonly IOrderService _orderService;
private readonly ILogger _logger;
private readonly ICategoryService _categoryService;
private readonly IProductAttributeParser _productAttributeParser;