Skip to content

Instantly share code, notes, and snippets.

View shanecowherd's full-sized avatar

Shane Cowherd shanecowherd

  • Cowherd.com, Making Blocks, PBSCO, Bulb, BombBomb, Echo1612
  • Colorado Springs
  • 05:44 (UTC -06:00)
View GitHub Profile
@shanecowherd
shanecowherd / jerrybutton.swift
Created March 22, 2023 04:37
JerryButton.swift
import SwiftUI
struct ContentView: View {
var body: some View {
VStack {
Text("Button")
.font(.system(size: 20, weight: .semibold, design: .rounded))
.frame(width: 200, height: 60)
.background(
ZStack {
@shanecowherd
shanecowherd / Reencoder.swift
Created February 6, 2023 21:44 — forked from trilliwon/Reencoder.swift
Reencoder ios swift
import AVFoundation
import os.log
/// https://developer.apple.com/library/archive/documentation/AudioVideo/Conceptual/AVFoundationPG/Articles/05_Export.html
/**
Steps
- Use serialization queues to handle the asynchronous nature of reading and writing audiovisual data
- Initialize an asset reader and configure two asset reader outputs, one for audio and one for video
- Initialize an asset writer and configure two asset writer inputs, one for audio and one for video
@shanecowherd
shanecowherd / TaskQueue.swift
Created December 20, 2022 17:07
AWS Amplify Task Queue
//
// Copyright Amazon.com Inc. or its affiliates.
// All Rights Reserved.
//
// SPDX-License-Identifier: Apache-2.0
//
import Foundation
public actor TaskQueue<Success> {
private var previousTask: Task<Success, Error>?
import UIKit
var unsortedNumbers = [1,5,7,9,2,4,7];
func bubbleSort(unsortedNumbers: inout [Int]) -> [Int] {
for _ in unsortedNumbers {
for (idx, _) in unsortedNumbers.enumerated() {
guard idx + 1 < unsortedNumbers.count else {
continue
}
@shanecowherd
shanecowherd / S3.php
Created August 7, 2022 21:20 — forked from marcoarment/S3.php
A simple PHP class to perform basic operations against Amazon S3 and compatible services.
<?php
/*
A simple PHP class to perform basic operations against Amazon S3 and compatible
services. Requires modern PHP (7+, probably) with curl, dom, and iconv modules.
Copyright 2022 Marco Arment. Released under the MIT license:
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
@shanecowherd
shanecowherd / Windows Server Download Chrome.ps1
Last active May 14, 2021 15:43
The default browser on Windows Server is locked down, this Powershell script allows you to download Chrome.
#https://www.snel.com/support/install-chrome-in-windows-server/
$LocalTempDir = $env:TEMP; $ChromeInstaller = "ChromeInstaller.exe"; (new-object System.Net.WebClient).DownloadFile('http://dl.google.com/chrome/install/375.126/chrome_installer.exe', "$LocalTempDir\$ChromeInstaller"); & "$LocalTempDir\$ChromeInstaller" /silent /install; $Process2Monitor = "ChromeInstaller"; Do { $ProcessesFound = Get-Process | ?{$Process2Monitor -contains $_.Name} | Select-Object -ExpandProperty Name; If ($ProcessesFound) { "Still running: $($ProcessesFound -join ', ')" | Write-Host; Start-Sleep -Seconds 2 } else { rm "$LocalTempDir\$ChromeInstaller" -ErrorAction SilentlyContinue -Verbose } } Until (!$ProcessesFound)
class AsyncOperation: Operation {
var completion: () -> Void
init(completion: @escaping () -> Void) {
self.completion = completion
}
override func main() {
let waitForFinish = DispatchGroup()
waitForFinish.enter()
@shanecowherd
shanecowherd / SwizzleWKWebviewPopupKeyboard.txt
Created July 2, 2020 23:17
OBCJ Swizzle to pop up a keyboard in WKWebview
If you need to programatically open the keyboard in a WKWebview, use this ObjC Swizzle.
https://stackoverflow.com/questions/32449870/programmatically-focus-on-a-form-in-a-webview-wkwebview/48623286#48623286
@shanecowherd
shanecowherd / logMilestone.swift
Created January 31, 2020 17:05 — forked from atomicbird/logMilestone.swift
Sometimes you just want to print a message that tells you a line of code was executed. Inspired by a tweet from Paige Sun: https://twitter.com/_PaigeSun/status/1161132108875796480
/// Log the current filename and function, with an optional extra message. Call this with no arguments to simply print the current file and function. Log messages will include an Emoji selected from a list in the function, based on the hash of the filename, to make it easier to see which file a message comes from.
/// - Parameter message: Optional message to include
/// - file: Don't use; Swift will fill in the file name
/// - function: Don't use, Swift will fill in the function name
/// - line: Don't use, Swift will fill in the line number
func logMilestone(_ message: String? = nil, file: String = #file, function: String = #function, line: Int = #line) -> Void {
#if DEBUG
// Feel free to change the list of Emojis, but don't make it shorter, because a longer list is better.
let logEmojis = ["😀","😎","😱","😈","👺","👽","👾","🤖","🎃","👍","👁","🧠","🎒","🧤","🐶","🐱","🐭","🐹","🦊","🐻","🐨","🐵","🦄","🦋","🌈","🔥","💥","⭐️","🍉","🥝","🌽","🍔","🍿","🎹","🎁","❤️","🧡","💛","💚","💙","💜","🔔"]
let logEmoji = logEmojis[abs(

Docker installation instructions

docker run --name heicconverter -v ~/Desktop/heicconverter:/root/heicconverter -p 8080:3000 -it ubuntu /bin/bash

Now you should be inside a docker container, run the following commends

cd ~/heicconverter
apt update; apt install nodejs npm libheif-examples -y