Skip to content

Commit

Permalink
Working.
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfmcnally committed Feb 26, 2024
1 parent 2440f33 commit 9fc5512
Show file tree
Hide file tree
Showing 18 changed files with 483 additions and 8 deletions.
3 changes: 3 additions & 0 deletions backupStudio
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!zsh

rsync -av --progress --delete --exclude '.DS_Store' --exclude '.Spotlight-V100' --exclude '.Trashes' --exclude '.DocumentRevisions-V100' --exclude '.TemporaryItems' --exclude '.fseventsd' /Volumes/Studio/ /Volumes/Studio\ Backup/
4 changes: 4 additions & 0 deletions clutter-off
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

defaults write com.apple.finder CreateDesktop false
killall Finder
4 changes: 4 additions & 0 deletions clutter-on
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

defaults write com.apple.finder CreateDesktop true
killall Finder
8 changes: 4 additions & 4 deletions commit
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

if [ "$#" -ne 1 ]
then
echo "Usage: ${0} \"Commit comment...\""
exit 1
comment="Working."
else
comment=$1
fi

comment=$1
echo "commit comment: ${comment}"
# echo "commit comment: ${comment}"

`dirname $0`/utils/gitHeader
git commit -a -m "${comment}" || true
9 changes: 5 additions & 4 deletions commitAll
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

if [ "$#" -ne 1 ]
then
echo "Usage: ${0} \"Commit comment...\""
exit 1
comment="Working."
else
comment=$1
fi

comment=$1
echo "comment: ${comment}"
# comment=$1
# echo "comment: ${comment}"

script="commit"
dir=`dirname $0`
Expand Down
27 changes: 27 additions & 0 deletions gourceHelper
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/zsh

# https://www.ekreative.com/blog/producing-your-own-git-repository-animated-visualization-video/
# https://github.com/acaudwell/Gource/wiki/Visualizing-Multiple-Repositories

GOURCE_LOGS=./gourceLogs
mkdir -p ${GOURCE_LOGS}

REPOS=($@)

for REPO in "${REPOS[@]}"
do
LOG_FILE=${GOURCE_LOGS}/${REPO}.txt
gource --output-custom-log ${LOG_FILE} ${REPO}
sed -i '' -r "/\.(xc)?framework/d" ${LOG_FILE}
sed -i '' -r "s/Robert McNally/Wolf McNally/" ${LOG_FILE}
sed -i '' -r "s#(.+)\|#\1|/${REPO}#" ${LOG_FILE}
done

COMBINED_LOG=${GOURCE_LOGS}/combined.txt

cat ${GOURCE_LOGS}/${^REPOS}.txt | sort -n > ${COMBINED_LOG}

gource --frameless --multi-sampling --hide root,bloom --filename-time 2 --bloom-multiplier 0.5 --bloom-intensity 0.5 --elasticity 0.001 --viewport 1920x1080 --highlight-users --highlight-colour aaffaa --user-scale 1.5 --max-user-speed 200 --user-friction 0.5 --highlight-dirs --dir-name-depth 1 --dir-colour aaaaff --seconds-per-day 0.1 --auto-skip-seconds 0.1 ${GOURCE_LOGS}/combined.txt

# --disable-auto-rotate
# --fixed-user-size
3 changes: 3 additions & 0 deletions imagineer-login
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/zsh

ssh -i "~/.ssh/arciem-keypair.pem" [email protected]
3 changes: 3 additions & 0 deletions imagineer-start
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/zsh

aws ec2 start-instances --instance-ids i-03db5ae1335fc09b7
3 changes: 3 additions & 0 deletions imagineer-stop
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/zsh

aws ec2 stop-instances --instance-ids i-03db5ae1335fc09b7
113 changes: 113 additions & 0 deletions makeContext
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
#!python3

import os
import sys
import time
import re
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler

# Mapping of file extensions to Markdown code syntax specifiers
syntax_highlighting = {
'.swift': 'swift',
'.py': 'python',
'.js': 'javascript',
'.ts': 'typescript',
}

# List of regexes for prioritizing specific files
priority_files = [r"STARTHERE"]

# List of regexes for omitting specific files
omit_files = [r".*\.(png|jpg|jpeg|gif|svg)"]

class ChangeHandler(FileSystemEventHandler):
def __init__(self, directory, output_file, process_func):
self.directory = directory
self.output_file = output_file
self.process_func = process_func

def on_any_event(self, event):
# Ignoring changes to the output file itself
if self.output_file and os.path.abspath(event.src_path) == os.path.abspath(self.output_file):
return
self.process_func(self.directory, self.output_file)

def list_files_and_contents(directory, output_file=None):
top_level_directory = os.path.basename(directory.rstrip(os.sep))
all_paths = []
priority_paths = []
omitted_paths = []
for root, dirs, files in os.walk(directory, topdown=True):
# Remove directories that start with '.'
dirs[:] = [d for d in dirs if not d.startswith('.')]
files = [f for f in files if not f.startswith('.')]
for filename in files:
full_path = os.path.join(root, filename)
if any(re.search(pattern, filename) for pattern in priority_files):
priority_paths.append(full_path)
elif any(re.search(pattern, filename) for pattern in omit_files):
omitted_paths.append(full_path)
else:
all_paths.append(full_path)

# Prioritize certain files by moving them to the front
all_paths = priority_paths + all_paths
all_paths.sort(key=lambda x: (x not in priority_paths, x))

output_lines = [f"# {top_level_directory}\n\n"]
for path in all_paths + omitted_paths:
relative_path = os.path.relpath(path, directory)
file_extension = os.path.splitext(path)[1]
syntax_specifier = syntax_highlighting.get(file_extension, '')
if path in omitted_paths:
output_lines.append(f"## {relative_path}\n\n*OMITTED*\n\n")
else:
output_lines.append(f"## {relative_path}\n\n```{syntax_specifier}\n")
try:
with open(path, 'r') as file:
content = file.read()
if content.endswith('\n'):
output_lines.append(content.rstrip('\n') + '\n```\n\n')
else:
output_lines.append(content + '\n```\n\n')
except Exception as e:
output_lines.append(f"Error reading file {relative_path}: {e}\n```\n\n")

if output_file:
with open(output_file, 'w') as f:
f.writelines(output_lines)
else:
print(''.join(output_lines))

def main():
output_file = None
watch = False

try:
directory = sys.argv[1]
if '-o' in sys.argv:
o_index = sys.argv.index('-o')
output_file = sys.argv[o_index + 1]
if '-w' in sys.argv:
watch = True
except (IndexError, ValueError):
print("Usage: script.py <directory_path> [-o output_file_path] [-w]")
sys.exit(1)

list_files_and_contents(directory, output_file)

if watch:
event_handler = ChangeHandler(directory, output_file, list_files_and_contents)
observer = Observer()
observer.schedule(event_handler, directory, recursive=True)
observer.start()
try:
while True:
time.sleep(1)
except KeyboardInterrupt:
observer.stop()
observer.join()

if __name__ == "__main__":
main()
13 changes: 13 additions & 0 deletions md2rtf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh

BASENAME=${1%%.*}
TEMPNAME=${BASENAME}.tmp
OUTPUTNAME=${BASENAME}.txt

echo "<html><head><style>body { font-size: 36pt; font-family:sans-serif; }</style></head><body>" > ${TEMPNAME}
markdown "${1}" >> ${TEMPNAME}
echo "</body></html>" >> ${TEMPNAME}

textutil "${TEMPNAME}" -inputencoding UTF-8 -format html -convert txt -output "${OUTPUTNAME}"

rm "${TEMPNAME}"
17 changes: 17 additions & 0 deletions remove-boilerplate-comments-from-xcode-templates.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

# Based on: https://paulz.github.io/xcode/source/code/2015/12/12/remove-default-header-comment-in-xcode.html

XCODE="Xcode-beta"
XCODE_DEV="/Applications/${XCODE}.app/Contents/Developer"
pushd "${XCODE_DEV}/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Templates"
find -E . -type f \
\( -regex '.*\.[chm]' -or -regex '.*\.swift' \) \
-exec sed -i '' '1,/^$/d' '{}' ';'
popd

pushd "${XCODE_DEV}/Library/Xcode/Templates"
find -E . -type f \
\( -regex '.*\.[chm]' -or -regex '.*\.swift' \) \
-exec sed -i '' '1,/^$/d' '{}' ';'
popd
3 changes: 3 additions & 0 deletions revision
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

git rev-parse --short HEAD
Loading

0 comments on commit 9fc5512

Please sign in to comment.