Skip to content

Instantly share code, notes, and snippets.

View jamesstout's full-sized avatar

James Stout jamesstout

View GitHub Profile
@jamesstout
jamesstout / upload_symbols.sh
Last active February 19, 2024 01:09
Xcode script to upload symbols to AppCenter during build phase
#!/usr/bin/env bash
# shellcheck shell=bash
# SEE: https://docs.microsoft.com/en-us/appcenter/diagnostics/iOS-symbolication#app-center-api
# AND: https://github.com/microsoft/appcenter-cli#commands
# Common functions
jcs_log () { echo "[JCS] $1"; }
# TODO: change to fail
@jamesstout
jamesstout / convertToHuman.sh
Last active September 15, 2021 23:15
Takes the output from du -k - file block count in 1024-byte (1-Kbyte) blocks and converts to a human readable form.
# $1 = file block count in 1024-byte (1-Kbyte) blocks.
# i.e. output from du -k
# no floating points, just ints, but check anyway
function convertToHuman {
size=$(echo $1 | sed -e 's/^\./0./') # add 0 for cases like ".0001"
size=${size/\.*} # convert to int
for unit in KB MB GB TB PB EB ZB YB; do
if [ "$size" -lt 1024 ]; then
echo "${size} ${unit}";
break;
@jamesstout
jamesstout / allTZ.sh
Created April 24, 2013 21:05
Get the current time in all the timezones known to your machine
#!/bin/bash
# Error logging
e_error() {
printf "$(tput setaf 1)x %s$(tput sgr0)\n" "$@"
}
# only do this if you know how to set it back
# set date/time to 10:00 AM PDT
# export TZ=PST8PDT
@jamesstout
jamesstout / vagrant-vscode-php-xdebug-instructions.md
Last active August 5, 2021 19:29 — forked from sveggiani/instructions.md
Configure Xdebug, Visual Studio Code for a Vagrant VM

0. Assumptions

  • You've installed Xdebug in your VM.
  • You've installed Xdebug extension for VSCode and reloaded/restarted VSCode.
  • You have not forwarded port 9000 from the guest to the host.
  • Configure Debugger in VSCode. See item 1 next.

1. Configure .vscode/launch.json

@jamesstout
jamesstout / verifyReceipt.php
Last active August 5, 2021 08:49
Verify iOS in-app purchase receipts
<?php
include("/var/www/vhosts/xxxxxcom/httpdocs/PHPUtils/dbConfig.php");
include("/var/www/vhosts/xxxxxcom/httpdocs/PHPUtils/DButils.php");
// verifies receipt from iOS in-app purchase
// returns:
// 0 - if params missing
// 1 - if receipt is valid
// 2 - if invalid receipt, or invalid response from verification server
// or bundle/in-app IDs are incorrect
@jamesstout
jamesstout / process.py
Last active July 12, 2021 07:24
add tz param to https://github.com/mwaterfall/alfred-datetime-format-converter to get the time in your location. Some testing done.
# -*- coding: utf-8 -*-
import alfred
import calendar
import time
import math
from delorean import utcnow, parse, epoch
# global var to see if user
# has a time offset
@jamesstout
jamesstout / cleanup-conflicts.sh
Last active June 8, 2021 22:09
Cleanup conflicted Nextcloud files
#!/usr/bin/env bash
# shellcheck shell=bash
# set -x
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# Header logging
e_header() {
printf "\n$(tput setaf 7)%s$(tput sgr0)\n" "$@"
}
@jamesstout
jamesstout / uniqRename.sh
Last active April 9, 2021 18:48
rename files to a random filename with 5 digits that contain random numbers and letters
#!/usr/bin/env bash
# IRC Issue from helperW
# Network: freenode
# Channel: #macosx
# I have a directory with 001.png 023.png 003.png ( around 800 files)
# I have to rename them to a random filename with : 5 digits that contain random numbers and letters
# ensure all vars are initialised and exit on error
@jamesstout
jamesstout / overcast.opml
Created April 22, 2018 09:23
Example OPML file from Overcast, note: it contains usernames and passwords in the feed URL
<?xml version="1.0"?>
<!-- example OPML file -->
<opml version="1.0">
<head>
<title>Overcast Podcast Subscriptions</title>
</head>
<body>
<outline type="rss" text="Richard Herring's Leicester Square Theatre Podcast" title="Richard Herring's Leicester Square Theatre Podcast" xmlUrl="http://feeds.feedburner.com/RichardHerringLSTPodcast" htmlUrl="https://www.comedy.co.uk/podcasts/richard_herring_lst_podcast/"/>
<outline type="rss" text="5by5 at the Movies" title="5by5 at the Movies" xmlUrl="http://feeds.5by5.tv/movies" htmlUrl="http://5by5.tv/movies"/>
<outline type="rss" text="TV Talk Machine" title="TV Talk Machine" xmlUrl="http://feeds.theincomparable.com/tvtm" htmlUrl="https://www.theincomparable.com/tvtm/"/>
@jamesstout
jamesstout / firebase.log
Created May 15, 2020 12:37
Firebase verbose logging
- [Firebase/Core][I-COR000001] Configuring the default app.
- [Firebase/Core][I-COR000033] Data Collection flag is not set.
- [Firebase/Installations][I-FIS002001] -[FIRInstallationsIDController installationWithValidAuthTokenForcingRefresh:0], appName: __FIRAPP_DEFAULT
- [Firebase/Installations][I-FIS002000] -[FIRInstallationsIDController createGetInstallationItemPromise], appName: __FIRAPP_DEFAULT
- [41112:16549661] [Firebase/Crashlytics] Version 4.1.0
- [Firebase/Crashlytics][I-CLS000000] [Crashlytics] Running on iOS Simulator (iPhone), 12.2.0 (17G12034)
- [Firebase/Crashlytics][I-CLS000000] [Crashlytics:Settings] No settings were cached
- [Firebase/Crashlytics][I-CLS000000] Root: /Users/james/Library/Developer/CoreSimulator/Devices/4EF0C0BF-0DF1-47D9-B9E6-19307E748F0E/data/Containers/Data/Application/7C3A9AE4-84B0-40A5-A24A-87DA7D4387F1/Library/Caches/com.crashlytics.data/com.tiberiushk.hkwarningspushtest
- [Firebase/Crashlytics][I-CLS000000] Automatic data collection is enabled.
- [Firebase/Crashlytics][I