Skip to content

Instantly share code, notes, and snippets.

@tomcurran
tomcurran / app.js
Created February 28, 2023 17:48
Firebase Messaging Test
const admin = require("firebase-admin");
const serviceAccount = require("./service-account.json");
const registrationToken = "REGISTRATION_TOKEN_1";
admin.initializeApp({
credential: admin.credential.cert(serviceAccount)
});
const message = {
@tomcurran
tomcurran / FirebaseTest.csproj
Created February 14, 2023 11:06
Firebase Messaging Test
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
@tomcurran
tomcurran / github-delete-artifacts.sh
Created January 4, 2023 13:32
Delete Artifacts in GitHub Repository
OWNER=$1
REPO=$2
echo "Owner: $OWNER"
echo "Repository: $REPO"
TOTAL_ARTIFACTS=$(gh api -H "Accept: application/vnd.github+json" /repos/$OWNER/$REPO/actions/artifacts | jq '.total_count')
echo "Total Artifacts: $TOTAL_ARTIFACTS"
echo "Deleting artifacts..."
@tomcurran
tomcurran / app-store-connect-jwt.rb
Created May 18, 2022 15:12
Create App Store Connect token for API requests from private key, issue ID, key ID
require "base64"
require "jwt"
ISSUER_ID = ""
KEY_ID = ""
PRIVATE_KEY_FILE=""
private_key = OpenSSL::PKey.read(File.read(PRIVATE_KEY_FILE))
token = JWT.encode(
{
@tomcurran
tomcurran / Program.cs
Created May 6, 2022 12:26
Remove releases from Firebase Distribution using API
using System.Net.Http.Headers;
using System.Net.Http.Json;
namespace FirebaseDistributionReleaseRemove
{
class Program
{
static async Task Main(string[] args)
{
// get project & app for each project from firebase console
@tomcurran
tomcurran / Resx.workbook
Created May 13, 2020 13:14
Resx entry duplicates & order
uti id title platforms
com.xamarin.workbook
67ee3be8-703f-4566-9b19-227768fb9dc5
Untitled
Console
using System;
@tomcurran
tomcurran / resignapk.sh
Last active May 13, 2020 10:33
Resign Android APK
#!/bin/bash
# Original https://code.google.com/p/apk-resigner/
# Sample usage is as follows;
# ./resignapk myapp.apk debug.keystore android androiddebugkey android
#
# param1, APK file: myapp.apk
# param2, keystore location: ~/.android/debug.keystore
# param3, keystore password: android
# param4, keystore alias: androiddebugkey
@tomcurran
tomcurran / ios2android.sh
Created May 13, 2020 10:30
Move images named in iOS convention to Android resource directories convention
#!/bin/bash
# Moves ios images (file.png, file@2x.png, file@3x.png) into android drawable folders (drawable-mdpi, drawable-xhdpi, drawable-xxhdpi) and normalises file names.
# Simplified version of https://github.com/Ninjanetic/ios2android MIT License (MIT)
rm -rf drawable-mdpi
rm -rf drawable-xhdpi
rm -rf drawable-xxhdpi
mkdir drawable-mdpi
mkdir drawable-xhdpi
@tomcurran
tomcurran / images2drawables.sh
Created May 13, 2020 10:29
Move images into Android drawable directories
#!/bin/bash
# Moves assets into android drawable folders and normalise file names.
# file@mdpi.png -> drawable-mdpi
# file@hdpi.png -> drawable-hdpi
# file@xhdpi.png -> drawable-xhdpi
# file@xxhdpi.png -> drawable-xxhdpi
# file@xxxhdpi.png -> drawable-xxxhdpi
# file.svg -> drawable-anydpi-v21 (svgs need converted to vector drawables using android studio vector asset import tool)
# Based on https://github.com/Ninjanetic/ios2android MIT License (MIT)
@tomcurran
tomcurran / svg2png.sh
Created May 13, 2020 10:27
Convert SVG to Android drawable PNGs
#!/bin/bash -e
# Transforms a SVG into a PNG for each platform
# Sizes extracted from
# http://developer.android.com/design/style/iconography.html
[ -z $2 ] && echo -e "ERROR: filename and one dimension (-w or -h) is required, for example:\nsvg2png -w48 icon.svg\n" && exit 1;
FILENAME=$2
DEST_FILENAME=`echo $2 | sed s/\.svg/\.png/`
FLAG=`echo $1 | cut -c1-2`
ORIGINAL_VALUE=`echo $1 | cut -c3-`